Part Number Hot Search : 
M13251GM GBU1002 2SK295 063XW10 R5110515 RF2054 LL414 MC10E116
Product Description
Full Text Search
 

To Download BCM2835 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  ? 2012 broadcom corporation. all rights reserved broadcom europe ltd. 406 science park milton road cambridge cb4 0ww BCM2835 arm peripherals
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page ii ? 2012 broadcom corporation. all rights reserved table of contents 1 introduction 4 1.1 overview 4 1.2 address map 4 1.2.1 diagrammatic overview 4 1.2.2 arm virtual addresses (standard linux kernel only) 6 1.2.3 arm physical addresses 6 1.2.4 bus addresses 6 1.3 peripheral access precautions for correct memory orderin g 7 2 auxiliaries: uart1 & spi1, spi2 8 2.1 overview 8 2.1.1 aux registers 9 2.2 mini uart 10 2.2.1 mini uart implementation details. 11 2.2.2 mini uart register details. 11 2.3 universal spi master (2x) 20 2.3.1 spi implementation details 20 2.3.2 interrupts 21 2.3.3 long bit streams 21 2.3.4 spi register details. 22 3 bsc 28 3.1 introduction 28 3.2 register view 28 3.3 10 bit addressing 36 4 dma controller 38 4.1 overview 38 4.2 dma controller registers 39 4.2.1 dma channel register address map 40 4.3 axi bursts 63 4.4 error handling 63 4.5 dma lite engines 63 5 external mass media controller 65 o introduction 65 o registers 66 6 general purpose i/o (gpio) 89 6.1 register view 90 6.2 alternative function assignments 102 6.3 general purpose gpio clocks 105 7 interrupts 109 7.1 introduction 109 7.2 interrupt pending. 110 7.3 fast interrupt (fiq). 110 7.4 interrupt priority. 110 7.5 registers 112 8 pcm / i2s audio 119 8.1 block diagram 120 8.2 typical timing 120 8.3 operation 121 8.4 software operation 122 8.4.1 operating in polled mode 122 8.4.2 operating in interrupt mode 123
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page iii ? 2012 broadcom corporation. all rights reserved 8.4.3 dma 123 8.5 error handling. 123 8.6 pdm input mode operation 124 8.7 gray code input mode operation 124 8.8 pcm register map 125 9 pulse width modulator 138 9.1 overview 138 9.2 block diagram 138 9.3 pwm implementation 139 9.4 modes of operation 139 9.5 quick reference 140 9.6 control and status registers 141 10 spi 148 10.1 introduction 148 10.2 spi master mode 148 10.2.1 standard mode 148 10.2.2 bidirectional mode 149 10.3 lossi mode 150 10.3.1 command write 150 10.3.2 parameter write 150 10.3.3 byte read commands 151 10.3.4 24bit read command 151 10.3.5 32bit read command 151 10.4 block diagram 152 10.5 spi register map 152 10.6 software operation 158 10.6.1 polled 158 10.6.2 interrupt 158 10.6.3 dma 158 10.6.4 notes 159 11 spi/bsc slave 160 11.1 introduction 160 11.2 registers 160 12 system timer 172 12.1 system timer registers 172 13 uart 175 13.1 variations from the 16c650 uart 175 13.2 primary uart inputs and outputs 176 13.3 uart interrupts 176 13.4 register view 177 14 timer (arm side) 196 14.1 introduction 196 14.2 timer registers: 196 15 usb 200 15.1 configuration 200 15.2 extra / adapted registers. 202
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 4 ? 2012 broadcom corporation. all rights reserved 1 introduction 1.1 overview BCM2835 contains the following peripherals which may safely be accessed by the arm: ? timers ? interrupt controller ? gpio ? usb ? pcm / i2s ? dma controller ? i2c master ? i2c / spi slave ? spi0, spi1, spi2 ? pwm ? uart0, uart1 the purpose of this datasheet is to provide documentation f or these peripherals in sufficient detail to allow a developer to port an operating system to BCM2835. there are a number of peripherals which are intended to be controlled by the gpu. these are omitted from this datasheet. accessing these peripherals f rom the arm is not recommended. 1.2 address map 1.2.1 diagrammatic overview in addition to the arm?s mmu, BCM2835 includes a second coar se-grained mmu for mapping arm physical addresses onto system bus addresses. t his diagram shows the main address spaces of interest:
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 5 ? 2012 broadcom corporation. all rights reserved
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 6 ? 2012 broadcom corporation. all rights reserved addresses in arm linux are: ? issued as virtual addresses by the arm core, then ? mapped into a physical address by the arm mmu, then ? mapped into a bus address by the arm mapping mmu, and finally ? used to select the appropriate peripheral or location in ram. 1.2.2 arm virtual addresses (standard linux kernel only) as is standard practice, the standard BCM2835 linux kernel pro vides a contiguous mapping over the whole of available ram at the top of memory. the kernel is configured for a 1gb/3gb split between kernel and user-space memory. the split between arm and gpu memory is selected by ins talling one of the supplied start*.elf files as start.elf in the fat32 boot partition of the sd card. the minimum amount of memory which can be given to the gpu is 32mb, but th at will restrict the multimedia performance; for example, 32mb does not provide enough buff ering for the gpu to do 1080p30 video decoding. virtual addresses in kernel mode will range between 0xc0000000 an d 0xefffffff. virtual addresses in user mode (i.e. seen by processes running in arm linux) will range between 0x00000000 and 0xbfffffff. peripherals (at physical address 0x20000000 on) are mapped into t he kernel virtual address space starting at address 0xf2000000. thus a peripheral advertise d here at bus address 0x7ennnnnn is available in the arm kenel at virtual address 0xf2nnnnnn. 1.2.3 arm physical addresses physical addresses start at 0x00000000 for ram. ? the arm section of the ram starts at 0x00000000. ? the videocore section of the ram is mapped in only if t he system is configured to support a memory mapped display (this is the common case) . the videocore mmu maps the arm physical address space to the bus address space seen by videocore (and videocore peripherals). the bus addresse s for ram are set up to map onto the uncached 1 bus address range on the videocore starting at 0xc0000000. physical addresses range from 0x20000000 to 0x20ffffff for peripherals . the bus addresses for peripherals are set up to map onto the periphe ral bus address range starting at 0x7e000000. thus a peripheral advertised here at bus address 0x7ennnnnn i s available at physical address 0x20nnnnnn. 1.2.4 bus addresses the peripheral addresses specified in this document ar e bus addresses. software directly accessing peripherals must translate these addresses into physical or virtual addresses, as described above. software accessing peripherals using the dm a engines must use bus addresses. 1 BCM2835 provides a 128kb system l2 cache, which is used primari ly by the gpu. accesses to memory are routed either via or around the l2 cache depending on senior two bits of the bus address.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 7 ? 2012 broadcom corporation. all rights reserved software accessing ram directly must use physical addres ses (based at 0x00000000). software accessing ram using the dma engines must use bus addresses (based at 0xc0000000). 1.3 peripheral access precautions for correct memor y ordering the BCM2835 system uses an amba axi-compatible interface structure. in order to keep the system complexity low and data throughput high, the bc m2835 axi system does not always return read data in-order 2 . the gpu has special logic to cope with data arriving out - of-order; however the arm core does not contain such l ogic. therefore some precautions must be taken when using the arm to access peripherals. accesses to the same peripheral will always arrive an d return in-order. it is only when switching from one peripheral to another that data can a rrive out-of-order. the simplest way to make sure that data is processed in-order is to place a memory barrier instruction at critical positions in the code. you should place: ? a memory write barrier before the first write to a peripheral. ? a memory read barrier after the last read of a periphe ral. it is not required to put a memory barrier instruction after each read or write access. only at those places in the code where it is possible that a peri pheral read or write may be followed by a read or write of a different peripheral. this is normally at the entry and exit poin ts of the peripheral service code. as interrupts can appear anywhere in the code so you should safeguard those. if an interrupt routine reads from a peripheral the routine should star t with a memory read barrier. if an interrupt routine writes to a peripheral the routine s hould end with a memory write barrier. 2 normally a processor assumes that if it executes two r ead operations the data will arrive in order. so a rea d from location x followed by a read from location y shoul d return the data of location x first, followed by the data of location y. data arriving out of order can have dis astrous consequences. for example: a_status = *pointer_to_peripheral_a; b_status = *pointer_to_peripheral_b; without precuations the values ending up in the variable s a_status and b_status can be swapped around. it is theoretical possible for writes to go ?wrong? but that is far more difficult to achieve. the axi syst em makes sure the data always arrives in-order at its int ended destination. so: *pointer_to_peripheral_a = value_a; *pointer_to_peripheral_b = value_b; will always give the expected result. the only time write data can arrive out-of-order is if two different peripherals are connected to the same external equipment.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 8 ? 2012 broadcom corporation. all rights reserved 2 auxiliaries: uart1 & spi1, spi2 2.1 overview the device has three auxiliary peripherals: one mini u art and two spi masters. these three peripheral are grouped together as they share the same area in the peripheral register map and they share a common interrupt. also all three a re controlled by the auxiliary enable register. auxiliary peripherals register map (offset = 0x7e21 5000) address register name 3 description size 0x7e21 5000 aux_irq auxiliary interrupt status 3 0x7e21 5004 aux_enables auxiliary enables 3 0x7e21 5040 aux_mu_io_reg mini uart i/o data 8 0x7e21 5044 aux_mu_ier_reg mini uart interrupt enable 8 0x7e21 5048 aux_mu_iir_reg mini uart interrupt identify 8 0x7e21 504c aux_mu_lcr_reg mini uart line control 8 0x7e21 5050 aux_mu_mcr_reg mini uart modem control 8 0x7e21 5054 aux_mu_lsr_reg mini uart line status 8 0x7e21 5058 aux_mu_msr_reg mini uart modem status 8 0x7e21 505c aux_mu_scratch mini uart scratch 8 0x7e21 5060 aux_mu_cntl_reg mini uart extra control 8 0x7e21 5064 aux_mu_stat_reg mini uart extra status 32 0x7e21 5068 aux_mu_baud_reg mini uart baudrate 16 0x7e21 5080 aux_spi0_cntl0_reg spi 1 control register 0 32 0x7e21 5084 aux_spi0_cntl1_reg spi 1 control register 1 8 0x7e21 5088 aux_spi0_stat_reg spi 1 status 32 0x7e21 5090 aux_spi0_io_reg spi 1 data 32 0x7e21 5094 aux_spi0_peek_reg spi 1 peek 16 0x7e21 50c0 aux_spi1_cntl0_reg spi 2 control register 0 32 0x7e21 50c4 aux_spi1_cntl1_reg spi 2 control register 1 8 3 these register names are identical to the defines in t he aux_io header file. for programming purposes these names should be used wherever possible.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 9 ? 2012 broadcom corporation. all rights reserved 0x7e21 50c8 aux_spi1_stat_reg spi 2 status 32 0x7e21 50d0 aux_spi1_io_reg spi 2 data 32 0x7e21 50d4 aux_spi1_peek_reg spi 2 peek 16 2.1.1 aux registers there are two auxiliary registers which control all t hree devices. one is the interrupt status register, the second is the auxiliary enable register . the auxiliary irq status register can help to hierarchically determine the source of an interrup t. auxirq register (0x7e21 5000) s ynopsis the auxirq register is used to check any pending interrupts which m ay be asserted by the three auxiliary sub blocks. bit(s) field name description type reset 31:3 reserved, write zero, read as don?t care 2 spi 2 irq if set the spi 2 module has an interrupt pendin g. r 0 1 spi 1 irq if set the spi1 module has an interrupt pendi ng. r 0 0 mini uart irq if set the mini uart has an interrupt pending. r 0 auxenb register (0x7e21 5004) s ynopsis the auxenb register is used to enable the three modules; uart, spi1, spi2. bit(s) field name description type reset 31:3 reserved, write zero, read as don?t care 2 spi2 enable if set the spi 2 module is enabled. if clear the spi 2 module is disabled. that also disables any spi 2 module register access r/w 0 1 spi 1 enable if set the spi 1 module is enabled. if clear the spi 1 module is disabled. that also disables any spi 1 module register access r/w 0 0 mini uart enable if set the mini uart is enabled. the uart will immediately start receiving data, especially if the uart1_rx line is low . if clear the mini uart is disabled. that also disables any mini uart register access r/w 0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 10 ? 2012 broadcom corporation. all rights reserved if the enable bits are clear you will have no access to a peripheral. you can not even read or write the registers! g pio pins should be set up first the before enabling the u art. the uart core is build to e mulate 16550 behaviour. so when it is enabled any data at the inputs will immediately be r eceived . if the uart1_rx line is low (because the gpio pi ns have not been set-up yet) t hat will be seen as a start bit and the uart will sta rt receiving 0x00-characters. v alid stops bits are not required for the uart. (see al so implementation details). hence a ny bit status is acceptable as stop bit and is only used so the re is clean timing start for the n ext bit. l ooking after a reset: the baudrate will be zero and the system clock will be 250 mhz. so o nly 2.5 seconds suffice to fill the receive fifo. the result will be that the fifo is full and o verflowing in no time flat. 2.2 mini uart the mini uart is a secondary low throughput 4 uart intended to be used as a console. it needs to be enabled before it can be used. it is also r ecommended that the correct gpio function mode is selected before enabling the mini uart. the mini uart has the following features: ? 7 or 8 bit operation. ? 1 start and 1 stop bit. ? no parities. ? break generation. ? 8 symbols deep fifos for receive and transmit. ? sw controlled rts, sw readable cts. ? auto flow control with programmable fifo level. ? 16550 like registers. ? baudrate derived from system clock. this is a mini uart and it does not have the following capabilities: ? break detection ? framing errors detection. ? parity bit ? receive time-out interrupt ? dcd, dsr, dtr or ri signals. the implemented uart is not a 16650 compatible uart however as far as possible the first 8 control and status registers are laid out like a 16550 uart. al 16550 register bits which are not supported can be written but will be ignore d and read back as 0. all control bits for simple uart receive/transmit operations are a vailable. 4 the uart itself has no throughput limitations in fact it can run up to 32 mega baud. but doing so requires significant cpu involvement as it has shallow fifos a nd no dma support.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 11 ? 2012 broadcom corporation. all rights reserved 2.2.1 mini uart implementation details. the uart1_cts and uart1_rx inputs are synchronised and will ta ke 2 system clock cycles before they are processed. the module does not check for any framing errors. after rec eiving a start bit and 8 (or 7) data bits the receiver waits for one half bit time and th en starts scanning for the next start bit. the mini uart does not check if the stop bit is high or wait for the stop bit t o appear. as a result of this a uart1_rx input line which is continuously lo w (a break condition or an error in connection or gpio setup) causes the receiver to continuously receive 0x00 symbols. the mini uart uses 8-times oversampling. the baudrate can be calculated from: ( ) 1 _ * 8 _ _ + = reg baudrate freq clock system baudrate if the system clock is 250 mhz and the baud register is zer o the baudrate is 31.25 mega baud. (25 mbits/sec or 3.125 mbytes/sec). the lowest baudrate w ith a 250 mhz system clock is 476 baud. when writing to the data register only the ls 8 bits are t aken. all other bits are ignored. when reading from the data register only the ls 8 bits are valid. all other bits are zero. 2.2.2 mini uart register details. aux_mu_io_reg register (0x7e21 5040) s ynopsis the aux_mu_io_reg register is primary used to write data to and read d ata from the uart fifos. if the dlab bit in the line control register is set this register gives access to the ls 8 bits of the baud rate. (note: there is easier access to the baud rate register) bit(s) field name description type reset 31:8 reserved, write zero, read as don?t care 7:0 ls 8 bits baudrate read/write, dlab=1 access to the ls 8 bits of the 16-bit baudrate register. (only if bit 7 of the line control register (dlab bit) is set) r/w 0 7:0 transmit data write, dlab=0 data written is put in the transmit fifo (provided it is not full) (only if bit 7 of the line control register (dlab bit) is clear) w 0 7:0 receive data read, dlab=0 data read is taken from the receive fifo (provided it is not empty) (only if bit 7 of the line control register (dlab bit) is clear) r 0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 12 ? 2012 broadcom corporation. all rights reserved aux_mu_iir_reg register (0x7e21 5044) s ynopsis the aux_mu_ier_reg register is primary used to enable interrupts if the dlab bit in the line control register is set this register gives access to the ms 8 bits of the baud rate. (note: there is easier access to the baud rate register) bit(s) field name description type reset 31:8 reserved, write zero, read as don?t care 7:0 ms 8 bits baudrate read/write, dlab=1 access to the ms 8 bits of the 16-bit baudrate register. (only if bit 7 of the line control register (dlab bit) i s set) r/w 0 7:2 reserved, write zero, read as don?t care some of these bits have functions in a 16550 compatible uart but are ignored here 1 enable receive interrupt (dlab=0) if this bit is set the interrupt line is asserted whenev er the receive fifo holds at least 1 byte. if this bit is clear no receive interrupts are generated. r 0 0 enable transmit interrupt (dlab=0) if this bit is set the interrupt line is asserted whenev er the transmit fifo is empty. if this bit is clear no transmit interrupts are generat ed. r 0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 13 ? 2012 broadcom corporation. all rights reserved aux_mu_ier_reg register (0x7e21 5048) s ynopsis the aux_mu_iir_reg register shows the interrupt status. it also has two fifo enable status bits and (when w riting) fifo clear bits. bit(s) field name description type reset 31:8 reserved, write zero, read as don?t care 7:6 fifo enables both bits always read as 1 as the fifos are always enabled r 11 5:4 - always read as zero r 00 3 - always read as zero as the mini uart has no timeout function r 0 2:1 read: interrupt id bits write: fifo clear bits on read this register shows the interrupt id bit 00 : no interrupts 01 : transmit holding register empty 10 : receiver holds valid byte 11 : on write: writing with bit 1 set will clear the receive fifo writing with bit 2 set will clear the transmit fif o r/w 00 0 interrupt pending this bit is clear whenever an interrupt is pending r 1
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 14 ? 2012 broadcom corporation. all rights reserved aux_mu_lcr_reg register (0x7e21 504c) s ynopsis the aux_mu_lcr_reg register controls the line data format and gives acces s to the baudrate register bit(s) field name description type reset 31:8 reserved, write zero, read as don?t care 7 dlab access if set the first to mini uart register give access the the baudrate register. during operation this bit must be cleared. r/w 0 6 break if set high the uart1_tx line is pulled low continuously. if held for at least 12 bits times that wi ll indicate a break condition. r/w 0 5:1 reserved, write zero, read as don?t care some of these bits have functions in a 16550 compatible uart but are ignored here 0 0 data size if clear the uart works in 7-bit mode if set the uart works in 8-bit mode r/w 0 aux_mu_mcr_reg register (0x7e21 5050) s ynopsis the aux_mu_mcr_reg register controls the 'modem' signals. bit(s) field name description type reset 31:8 reserved, write zero, read as don?t care 7:2 reserved, write zero, read as don?t care some of these bits have functions in a 16550 compatible uart but are ignored here 0 1 rts if clear the uart1_rts line is high if set the uart1_rts line is low this bit is ignored if the rts is used for auto-flow control. see the mini uart extra control register description) r/w 0 0 reserved, write zero, read as don?t care this bit has a function in a 16550 compatible uart but is ignored here 0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 15 ? 2012 broadcom corporation. all rights reserved aux_mu_lsr_reg register (0x7e21 5054) s ynopsis the aux_mu_lsr_reg register shows the data status. bit(s) field name description type reset 31:8 reserved, write zero, read as don?t care 7 reserved, write zero, read as don?t care this bit has a function in a 16550 compatible uart but is ignored here 0 6 transmitter idle this bit is set if the transmit fifo is empty and the transmitter is idle. (finished shifting out the last bit). r 1 5 transmitter empty this bit is set if the transmit fifo can accept at lea st one byte. r 0 4:2 reserved, write zero, read as don?t care some of these bits have functions in a 16550 compatible uart but are ignored here 0 1 receiver overrun this bit is set if there was a receiver overrun. that is: one or more characters arrived whilst the receive fifo was full. the newly arrived charters have been discarded. this bit is cleared each time this register is read. to do a non-destructive read of this overrun bit use the mini uart extra status register. r/c 0 0 data ready this bit is set if the receive fifo holds at least 1 symbol. r 0 aux_mu_msr_reg register (0x7e21 5058) s ynopsis the aux_mu_msr_reg register shows the 'modem' status. bit(s) field name description type reset 31:8 reserved, write zero, read as don?t care 7:6 reserved, write zero, read as don?t care some of these bits have functions in a 16550 compatible uart but are ignored here 0 5 cts status this bit is the inverse of the uart1_cts input thus : if set the uart1_cts pin is low if clear the uart1_cts pin is high r 1 3:0 reserved, write zero, read as don?t care some of these bits have functions in a 16550 compatible uart but are ignored here 0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 16 ? 2012 broadcom corporation. all rights reserved aux_mu_scratch register (0x7e21 505c) s ynopsis the aux_mu_scratch is a single byte storage. bit(s) field name description type reset 31:8 reserved, write zero, read as don?t care 7:0 scratch one whole byte extra on top of the 134217728 provided by the sdc r/w 0 aux_mu_cntl_reg register (0x7e21 5060) s ynopsis the aux_mu_cntl_reg provides access to some extra useful and nice features not found on a normal 16550 uart . bit(s) field name description type reset 31:8 reserved, write zero, read as don?t care 7 cts assert level this bit allows one to invert the cts auto flow operation polarity. if set the cts auto flow assert level is low* if clear the cts auto flow assert level is high* r/w 0 6 rts assert level this bit allows one to invert the rts auto flow operation polarity. if set the rts auto flow assert level is low* if clear the rts auto flow assert level is high* r/w 0 5:4 rts auto flow level these two bits specify at what receiver fifo level the rts line is de-asserted in auto-flow mode. 00 : de-assert rts when the receive fifo has 3 empty spaces left. 01 : de-assert rts when the receive fifo has 2 empty spaces left. 10 : de-assert rts when the receive fifo has 1 empty space left. 11 : de-assert rts when the receive fifo has 4 empty spaces left. r/w 0 3 enable transmit auto flow-control using cts if this bit is set the transmitter will stop if the ct s line is de-asserted. if this bit is clear the transmitter will ignore the status of the cts line r/w 0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 17 ? 2012 broadcom corporation. all rights reserved 2 enable receive auto flow- control using rts if this bit is set the rts line will de-assert if the receive fifo reaches it 'auto flow' level. in fact t he rts line will behave as an rtr (ready to receive) line. if this bit is clear the rts line is controlled by the aux_mu_mcr_reg register bit 1. r/w 0 1 transmitter enable if this bit is set the mini uart transmitter is enable d. if this bit is clear the mini uart transmitter is disabled r/w 1 0 receiver enable if this bit is set the mini uart receiver is enabled. if this bit is clear the mini uart receiver is disabled r/w 1 receiver enable if this bit is set no new symbols will be accepted by the receiver. any symbols in progress of reception will be finished. transmitter enable if this bit is set no new symbols will be send the trans mitter. any symbols in progress of transmission will be finished. auto flow control automatic flow control can be enabled independent for the receiver and the transmitter. cts auto flow control impacts the transmitter only. t he transmitter will not send out new symbols when the cts line is de-asserted. any symbols in progress of transmission when the cts line becomes de-asserted will be finished. rts auto flow control impacts the receiver only. in f act the name rts for the control line is incorrect and should be rtr (ready to receive). the rec eiver will de-asserted the rts (rtr) line when its receive fifo has a number of empty spaces left. normally 3 empty spaces should be enough. if looping back a mini uart using full auto flow control the logic is fast enough to allow the rts auto flow level of '10' (de-assert rts when t he receive fifo has 1 empty space left). auto flow polarity to offer full flexibility the polarity of the cts and rts (rtr) lines can be programmed. this should allow the mini uart to interface with any e xisting hardware flow control available.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 18 ? 2012 broadcom corporation. all rights reserved aux_mu_stat_reg register (0x7e21 5064) s ynopsis the aux_mu_stat_reg provides a lot of useful information about the inte rnal status of the mini uart not found on a normal 16550 uart. bit(s) field name description type reset 31:28 reserved, write zero, read as don?t care 27:24 transmit fifo fill level these bits shows how many symbols are stored in the transmit fifo the value is in the range 0-8 r 0 23:20 reserved, write zero, read as don?t care 19:16 receive fifo fill level these bits shows how many symbols are stored in the receive fifo the value is in the range 0-8 r 0 15:10 reserved, write zero, read as don?t care 9 transmitter done this bit is set if the transmitter is idle and the tra nsmit fifo is empty. it is a logic and of bits 2 and 8 r 1 8 transmit fifo is empty if this bit is set the transmitter fifo is empty. thus it can accept 8 symbols. r 1 7 cts line this bit shows the status of the uart1_cts line. r 0 6 rts status this bit shows the status of the uart1_rts li ne. r 0 5 transmit fifo is full this is the inverse of bit 1 r 0 4 receiver overrun this bit is set if there was a receiver overrun. that is: one or more characters arrived whilst the receive fifo was full. the newly arrived characters have been discarded. this bit is cleared each time the aux_mu_lsr_reg register is read. r 0 3 transmitter is idle if this bit is set the transmitter is idle. if this bit is clear the transmitter is idle. r 1 2 receiver is idle if this bit is set the receiver is idle. if this bit is clear the receiver is busy. this bit can change unless the receiver is disabled r 1 1 space available if this bit is set the mini uart transmitter fifo can accept at least one more symbol. if this bit is clear the mini uart transmitter fifo is full r 0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 19 ? 2012 broadcom corporation. all rights reserved 0 symbol available if this bit is set the mini uart receive fifo contains at least 1 symbol if this bit is clear the mini uart receiver fifo is empty r 0 receiver is idle this bit is only useful if the receiver is disabled. the normal use is to disable the receiver. then check (or wait) until the bit is set. now you can be sure that no new symbols will arrive. (e.g. now you can change the baudrate...) transmitter is idle this bit tells if the transmitter is idle. note that th e bit will set only for a short time if the transmit fifo contains data. normally you want to use bit 9: transmitter done. rts status this bit is useful only in receive auto flow-control mode a s it shows the status of the rts line. aux_mu_baud register (0x7e21 5068) s ynopsis the aux_mu_baud register allows direct access to the 16-bit wide baudr ate counter. bit(s) field name description type reset 31:16 reserved, write zero, read as don?t care 15:0 baudrate mini uart baudrate counter r/w 0 this is the same register as is accessed using the labd bit and the first two register, but much easier to access.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 20 ? 2012 broadcom corporation. all rights reserved 2.3 universal spi master (2x) the two universal spi masters are secondary low throughput 5 spi interfaces. like the uart the devices needs to be enabled before they can be used. e ach spi master has the following features: ? single beat bit length between 1 and 32 bits. ? single beat variable bit length between 1 and 24 bits ? multi beat infinite bit length. ? 3 independent chip selects per master. ? 4 entries 32-bit wide transmit and receive fifos. ? data out on rising or falling clock edge. ? data in on rising or falling clock edge. ? clock inversion (idle high or idle low). ? wide clocking range. ? programmable data out hold time. ? shift in/out ms or ls bit first a major issue with an spi interface is that there i s no spi standard in any form. because the spi interface has been around for a long time some pseudo- standard rules have appeared mostly when interfacing with memory devices. the universal s pi master has been developed to work even with the most 'non-standard' spi devices. 2.3.1 spi implementation details the following diagrams shows a typical spi access cycl e. in this case we have 8 spi clocks. 1 bit time set-up operate hold (optional) idle clk cs_n one bit time before any clock edge changes the cs_n will go l ow. this makes sure that the mosi signal has a full bit-time of set-up against any cha nging clock edges. the operation normally ends after the last clock cycle . note that at the end there is one half- bit time where the clock does not change but which still is part of the operation cycle. there is an option to add a half bit cycle hold time. t his makes sure that any miso data has at least a full spi bit time to arrive. (without this hold time, data clocked out of the spi device on the last clock edge would have only half a bit tim e to arrive). 5 again the spis themselves have no throughput limitations i n fact they can run with an spi clock of 125 mhz. but doing so requires significant cpu involvement as they have shallow fifos and no dma support.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 21 ? 2012 broadcom corporation. all rights reserved last there is a guarantee of at least a full bit time where the spi chip select is high. a longer cs_n high period can be programmed for another 1-7 cycles. the spi clock frequency is: )1 _ (* 2 _ _ _ + = field speed freq clock system clk spix if the system clock is 250 mhz and the speed field is zero t he spi clock frequency is 125 mhz. the practical spi clock will be lower as the i/o pads can not transmit or receive signals at such high speed. the lowest spi clock frequency wi th a 250 mhz system clock is 30.5 khz. the hardware has an option to add hold time to the mosi signal against the spi clk. this is again done using the system clock. so a 250 mhz system clock will add hold times in units of 4 ns. hold times of 0, 1, 4 and 7 system clock cycles can be used. (so at 250mhz an additional hold time of 0, 4, 16 and 28 ns can be achieved). t he hold time is additional to the normal output timing as specified in the data sheet. 2.3.2 interrupts the spi block has two interrupts: tx fifo is empty, spi is idle. tx fifo is empty: this interrupt will be asserted as soon as the last ent ry has been read from the transmit fifo. at that time the interface will still be busy shiftin g out that data. this also implies that the receive fifo will not yet contain the last received data. it is possible at that time to fill the tx fifo again and read the receive fifo entries which have been received. note that there is no "receive fifo full" interrupt as the number of en tries received is always equal to the number of entries transmitted. spi is idle: this interrupt will be asserted when the transmit fifo is empty and the spi block has finished all actions (including the cs-high time) by this ti me the receive fifo will have all received data as well. 2.3.3 long bit streams the spi module works in bursts of maximum 32 bits. some spi devices require data which is longer the 32 bits. to do this the user must make use of the two different data tx addresses: tx data written to one address cause the cs to r emain asserted. tx data written to the other address cause the cs to be de-asserted at the end of the transmit cycle. so in order to exchange 96 bits you do the following: write the first two data words to one address, then write the third word to the other address.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 22 ? 2012 broadcom corporation. all rights reserved 2.3.4 spi register details. auxspi0/1_cntl0 register (0x7e21 5080,0x7e21 50c0) s ynopsis the auxspix_cntl0 register control many features of the spi interfaces. bit(s) field name description type reset 31:20 speed sets the spi clock speed. spi clk freq = system_clock_freq/2*(speed+1) r/w 0 19:17 chip selects the pattern output on the cs pins when active . r/w 111 16 post-input mode if set the spi input works in post input mode. for details see text further down r/w 0 15 variable cs if 1 the spi takes the cs pattern and the data from the tx fifo if 0 the spi takes the cs pattern from bits 17-19 of this register set this bit only if also bit 14 (variable width) is set r/w 0 14 variable width if 1 the spi takes the shift length and the data from the tx fifo if 0 the spi takes the shift length from bits 0-5 of this register r/w 0 13:12 dout hold time controls the extra dout hold time in system clock cycles. 00 : no extra hold time 01 : 1 system clock extra hold time 10 : 4 system clocks extra hold time 11 : 7 system clocks extra hold time r/w 0 11 enable enables the spi interface. whilst disabled the fifos can still be written to or read from this bit should be 1 during normal operation. r/w 0 10 in rising if 1 data is clocked in on the rising edge of the spi clock if 0 data is clocked in on the falling edge of the spi clock r/w 0 9 clear fifos if 1 the receive and transmit fifos are held in reset (and thus flushed.) this bit should be 0 during normal operation. r/w 0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 23 ? 2012 broadcom corporation. all rights reserved 8 out rising if 1 data is clocked out on the rising edge of the spi clock if 0 data is clocked out on the falling edge of the spi clock r/w 0 7 invert spi clk if 1 the 'idle' clock line state is high. if 0 the 'idle' clock line state is low. r/w 0 6 shift out ms bit first if 1 the data is shifted out starting with the ms bit. (bit 15 or bit 11) if 0 the data is shifted out starting with the ls bit. (bi t 0) r/w 0 5:0 shift length specifies the number of bits to shift this field is ignored when using 'variable shift' mode r/w 0 invert spi clk changing this bit will immediately change the polarity of the spi clock output. it is recommended not to do this when also the cs is active a s the connected devices will see this as a clock change. dout hold time because the interface runs of fast silicon the mosi hold time against the clock will be very short. this can cause considerable problems on spi slaves . to make it easier for the slave to see the data the hold time of the mosi out against the spi clock out is programmable. no hold time mosi clk with hold time mosi clk variable width in this mode the shift length is taken from the transmit fifo. the transmit data bits 28:24 are used as shift length and the data bits 23:0 are the actual tra nsmit data. if the option 'shift ms out first' is selected the first bit shifted out will be bit 23. the receive data will arrive as normal. variable cs this mode is used together with the variable width mode. in this mode the cs pattern is taken from the transmit fifo. the transmit data bits 31: 29 are used as cs and the data bits 23:0 are the actual transmit data. this allows the cpu to write to different spi devices without having to change the cs bits. however the data lengt h is limited to 24 bits. post-input mode some rare spi devices output data on the falling clock edge w hich then has to be picked up on the next falling clock edge. there are two problems wi th this: 1. the very first falling clock edge there is no valid data a rriving. 2. after the last clock edge there is one more 'dangling' bi t to pick up.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 24 ? 2012 broadcom corporation. all rights reserved the post-input mode is specifically to deal with this sort of data. if the post-input mode bit is set, the data arriving at the first falling clock edge is ignored. then after the last falling clock edge the cs remain asserted and after a full bit time the last data bit is picked up. the following figure shows this behaviour: clk cs_n get first bit get last bit in this mode the cs will go high 1 full spi clock cycle a fter the last clock edge. this guarantees a full spi clock cycle time for the data to s ettle and arrive at the miso input. auxspi0/1_cntl1 register (0x7e21 5084,0x7e21 50c4) s ynopsis the auxspix_cntl1 registers control more features of the spi interfaces . bit(s) field name description type reset 31:18 - reserved, write zero, read as don?t care 10:8 cs high time additional spi clock cycles where the cs i s high. r/w 0 7 tx empty irq if 1 the interrupt line is high when the transmit fifo is empty r/w 0 6 done irq if 1 the interrupt line is high when the inte rface is idle r/w 0 5:2 - reserved, write zero, read as don?t care 1 shift in ms bit first if 1 the data is shifted in starting with the ms bit. (bit 15) if 0 the data is shifted in starting with the ls bit. (bit 0) r/w 0 0 keep input if 1 the receiver shift register is not cleared. thus new data is concatenated to old data. if 0 the receiver shift register is cleared before eac h transaction. r/w 0 keep input setting the 'keep input' bit will make that the input shift re gister is not cleared between transactions. however the contents of the shift regis ter is still written to the receive fifo at the end of each transaction. e.g. if you receive two 8 bi t values 0x81 followed by 0x46 the receive fifo will contain: 0x0081 in the first entry and 0x8146 in the second entry. this mode may save cpu time concatenating bits (4 bits follow ed by 12 bits).
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 25 ? 2012 broadcom corporation. all rights reserved cs high time the spi cs will always be high for at least 1 spi clo ck cycle. some spi devices need more time to process the data. this field will set a longe r cs-high time. so the actual cs high time is (cs_high_time + 1) (in spi clock cycles). interrupts the spi block has two interrupts: tx fifo is empty, spi is idle. tx fifo is empty: this interrupt will be asserted as soon as the last ent ry has been read from the transmit fifo. at that time the interface will still be busy shiftin g out that data. this also implies that the receive fifo will not yet contain the last received data. it is possible at that time to fill the tx fifo again and read the receive fifo entries which have been received. there is a rx fifo level field which tells exactly how many words are in the receive fifo. in general at that time the rece ive fifo should contain the number of tx items minus one (the last one still being received). note that there is no "receive fifo full" interrupt or "receive fifo overflow" flag as the number of entries received can never be more then the number of entries transmitted. aux is idle: this interrupt will be asserted when the module has finishe d all activities, including waiting the minimum cs high time. this guarantees that any recei ve data will be available and `transparent' changes can be made to the configuration re gister (e.g. inverting the spi clock polarity). auxspi0/1_stat register (0x7e21 5088,0x7e21 50c8) s ynopsis the auxspix_stat registers show the status of the spi interfaces. bit(s) field name description type reset 31:24 tx fifo level the number of data units in the transmit data fifo r/w 0 23:12 rx fifo level the number of data units in the receive data fifo. r/w 0 11:5 - reserved, write zero, read as don?t care 4 tx full if 1 the transmit fifo is full if 0 the transmit fifo can accept at least 1 data unit. r/w 0 3 tx empty if 1 the transmit fifo is empty if 0 the transmit fifo holds at least 1 data unit. r/w 0 2 rx empty if 1 the receiver fifo is empty if 0 the receiver fifo holds at least 1 data unit. r/w 0 6 busy indicates the module is busy transferring data. r/w 0 5:0 bit count the number of bits still to be processed. starts with 'shift-length' and counts down. r/w 0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 26 ? 2012 broadcom corporation. all rights reserved busy this status bit indicates if the module is busy. it wil l be clear when the tx fifo is empty and the module has finished all activities, including wait ing the minimum cs high time. auxspi0/1_peek register (0x7e21 508c,0x7e21 50cc) s ynopsis the auxspix_peek registers show received data of the spi interfaces. bit(s) field name description type reset 31:16 - reserved, write zero, read as don?t care 15:0 data reads from this address will show the top entry from the receive fifo, but the data is not taken from the fifo. this provides a means of inspecting the data but not removing it from the fifo. ro 0 auxspi0/1_io register (0x7e21 50a0-0x7e21 50ac 0x7e21 50e0-0x7e21 50ec) s ynopsis the auxspix_io registers are the primary data port of the spi inte rfaces these four addresses all write to the same fifo. writing to any of these addresses causes the spi cs _n pins to be de-asserted at the end of the access bit(s) field name description type reset 31:16 - reserved, write zero, read as don?t care 15:0 data writes to this address range end up in the transmit fifo. data is lost when writing whilst the transmit fifo is full. reads from this address will take the top entry from the receive fifo. reading whilst the receive fifo is will return the last data received. r/w 0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 27 ? 2012 broadcom corporation. all rights reserved auxspi0/1_txhold register (0x7e21 50b0-0x7e21 50bc 0x7e21 50f0-0x7e21 50fc) s ynopsis the auxspix_txhold registers are the extended cs port of the spi interf aces these four addresses all write to the same fifo. writing to these addresses causes the spi cs_n pins to remain asserted at the end of the access bit(s) field name description type reset 31:16 - reserved, write zero, read as don?t care 15:0 data writes to this address range end up in the transmit fifo. data is lost when writing whilst the transmit fifo is full. reads from this address will take the top entry from the receive fifo. reading whilst the receive fifo is will return the last data received. r/w 0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 28 ? 2012 broadcom corporation. all rights reserved 3 bsc 3.1 introduction the broadcom serial controller (bsc) controller is a master, fast-mode (400kb/s) bsc controller. the broadcom serial control bus is a pro prietary bus compliant with the philips? i2c bus/interface version 2.1 january 2000. ? i 2 c single master only operation (supports clock stretching w ait states) ? both 7-bit and 10-bit addressing is supported. ? timing completely software controllable via registers 3.2 register view the bsc controller has eight memory-mapped registers. all accesses are assumed to be 32- bit. note that the bsc2 master is used dedicated with the hdmi interface and should not be accessed by user programs. there are three bsc masters inside bcm. the register addresses starts from ? bsc0: 0x7e20_5000 ? bsc1: 0x7e80_4000 ? bsc2 : 0x7e80_5000 the table below shows the address of i 2 c interface where the address is an offset from one of the three base addreses listed above. i2c address map address offset register name description size 0x0 c control 32 0x4 s status 32 0x8 dlen data length 32 0xc a slave address 32 0x10 fifo data fifo 32 0x14 div clock divider 32 0x18 del data delay 32
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 29 ? 2012 broadcom corporation. all rights reserved 0x1c clkt clock stretch timeout 32 c register synopsis the control register is used to enable interrupts, c lear the fifo, define a read or write operation and start a transfer. the read field specifies the type of transfer. the clear field is used to clear the fifo. writing t o this field is a one-shot operation which will always read back as zero. the clear bit can se t at the same time as the start transfer bit, and will result in the fifo bei ng cleared just prior to the start of transfer. note that clearing the fifo during a tran sfer will result in the transfer being aborted. the st field starts a new bsc transfer. this has a one shot action, and so the bit will always read back as 0 . the intd field enables interrupts at the end of a t ransfer the done condition. the interrupt remains active until the done condition is cleared by writing a 1 to the i2cs.done field. writing a 0 to the intd field disa bles interrupts on done. the intt field enables interrupts whenever the fifo is or more empty and needs writing (i.e. during a write transfer) - the txw con dition. the interrupt remains active until the txw condition is cleared by writing suffici ent data to the fifo to complete the transfer. writing a 0 to the intt field disables in terrupts on txw. the intr field enables interrupts whenever the fifo is or more full and needs reading (i.e. during a read transfer) - the rxr condition. t he interrupt remains active until the rxw condition is cleared by reading sufficient data fro m the rx fifo. writing a 0 to the intr field disables interrupts on rxr. the i2cen field enables bsc operations. if this bit is 0 then transfers will not be performed. all register accesses are still permitted however. bit(s) field name description type reset 31:16 reserved - write as 0, read as don't care 15 i2cen i2c enable 0 = bsc controller is disabled 1 = bsc controller is enabled rw 0x0 14:11 reserved - write as 0, read as don't care 10 intr intr interrupt on rx 0 = don t generate interrupts on rxr condition. 1 = generate interrupt while rxr = 1. rw 0x0 9 intt intt interrupt on tx 0 = don t generate interrupts on txw condition. 1 = generate interrupt while txw = 1. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 30 ? 2012 broadcom corporation. all rights reserved 8 intd intd interrupt on done 0 = don t generate interrupts on done condition. 1 = generate interrupt while done = 1. rw 0x0 7 st st start transfer 0 = no action. 1 = start a new transfer. one shot operation. read back as 0. rw 0x0 6 reserved - write as 0, read as don't care 5:4 clear clear fifo clear 00 = no action. x1 = clear fifo. one shot operation. 1x = clear fifo. one shot operation. if clear and st are both set in the same operation, the fifo is cleared before the new frame is started. read back as 0. note: 2 bits are used to maintain compatibility to previous version. rw 0x0 3:1 reserved - write as 0, read as don't care 0 read read read transfer 0 = write packet transfer. 1 = read packet transfer. rw 0x0 s register
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 31 ? 2012 broadcom corporation. all rights reserved synopsis the status register is used to record activity status, errors and interrupt requests. the ta field indicates the activity status of the bsc controller. this read-only field returns a 1 when the controller is in the middle of a transfer and a 0 when idle. the done field is set when the transfer completes. t he done condition can be used with i2cc.intd to generate an interrupt on transfer completion. the done field is reset by writing a 1 , writing a 0 to the field has no effect. the read-only txw bit is set during a write transfer and the fifo is less than full and needs writing. writing sufficient data (i.e. enough data to either fill the fifo more than full or complete the transfer) to the fifo will clea r the field. when the i2cc.intt control bit is set, the txw condition can be used to g enerate an interrupt to write more data to the fifo to complete the current transfer. if the i2c controller runs out of data to send, it will wait for more data to be written i nto the fifo. the read-only rxr field is set during a read transfe r and the fifo is or more full and needs reading. reading sufficient data to bring the depth below will clear the field. when i2cc.intr control bit is set, the rxr condition can be used to generate an interrupt to read data from the fifo before it becom es full. in the event that the fifo does become full, all i2c operations will stall unti l data is removed from the fifo. the read-only txd field is set when the fifo has spa ce for at least one byte of data. txd is clear when the fifo is full. the txd field can be used to check that the fifo can accept data before any is written. any writes to a f ull tx fifo will be ignored. the read-only rxd field is set when the fifo contains at least one byte of data. rxd is cleared when the fifo becomes empty. the rxd field can be used to check that the fifo contains data before reading. reading from an empty fifo will return invalid data. the read-only txe field is set when the fifo is empt y. no further data will be transmitted until more data is written to the fifo. the read-only rxf field is set when the fifo is full . no more clocks will be generated until space is available in the fifo to receive more data. the err field is set when the slave fails to acknowle dge either its address or a data byte written to it. the err field is reset by writing a 1 , writing a 0 to the field has no effect. the clkt field is set when the slave holds the scl signal high for too long (clock stretching). the clkt field is reset by writing a 1 , writing a 0 to the field has no effect. bit(s) field name description type reset 31:10 reserved - write as 0, read as don't care 9 clkt clkt clock stretch timeout 0 = no errors detected. 1 = slave has held the scl signal low (clock stretching) for longer and that specified in the i2cclkt register cleared by writing 1 to the field. rw 0x0 8 err err ack error 0 = no errors detected. 1 = slave has not acknowledged its address. cleared by writing 1 to the field. rw 0x0 7 rxf rxf - fifo full 0 = fifo is not full. 1 = fifo is full. if a read i s underway, no further serial data will be received until data is read from fifo. ro 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 32 ? 2012 broadcom corporation. all rights reserved 6 txe txe - fifo empty 0 = fifo is not empty. 1 = fifo is empty. if a write is underway, no further serial data can be transmitted until data is written to the fifo. ro 0x1 5 rxd rxd - fifo contains data 0 = fifo is empty. 1 = fifo contains at least 1 byte. cleared by reading sufficient data from fifo. ro 0x0 4 txd txd - fifo can accept data 0 = fifo is full. the fifo cannot accept more data. 1 = fifo has space for at least 1 byte. ro 0x1 3 rxr rxr - fifo needs reading ( full) 0 = fifo is less than full and a read is underway. 1 = fifo is or more full and a read is underway. cleared by reading sufficient data from the fifo. ro 0x0 2 txw txw - fifo needs writing ( full) 0 = fifo is at least full and a write is underway (or sufficient data to send). 1 = fifo is less then full and a write is underway. cleared by writing sufficient data to the fifo. ro 0x0 1 done done transfer done 0 = transfer not completed. 1 = transfer complete. cleared by writing 1 to the field. rw 0x0 0 ta ta transfer active 0 = transfer not active. 1 = transfer active. ro 0x0 dlen register synopsis the data length register defines the number of bytes of data to transmit or receive in the i2c transfer. reading the register gives the nu mber of bytes remaining in the current transfer. the dlen field specifies the number of bytes to be tr ansmitted/received. reading the dlen field when a transfer is in progress (ta = 1) returns the number of bytes still to be transmitted or received. reading the dlen field w hen the transfer has just completed (done = 1) returns zero as there are no mor e bytes to transmit or receive. finally, reading the dlen field when ta = 0 and done = 0 returns the last value written. the dlen field can be left over multiple tr ansfers. bit(s) field name description type reset 31:16 reserved - write as 0, read as don't care
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 33 ? 2012 broadcom corporation. all rights reserved 15:0 dlen data length. writing to dlen specifies the number of bytes to be transmitted/received. reading from dlen when ta = 1 or done = 1, returns the number of bytes still to be transmitted or received. reading from dlen when ta = 0 and done = 0, returns the last dlen value written. dlen can be left over multiple packets. rw 0x0 a register synopsis the slave address register specifies the slave addre ss and cycle type. the address register can be left across multiple transfers the addr field specifies the slave address of the i2 c device. bit(s) field name description type reset 31:7 reserved - write as 0, read as don't care 6:0 addr slave address. rw 0x0 fifo register synopsis the data fifo register is used to access the fifo. wr ite cycles to this address place data in the 16-byte fifo, ready to transmit on the b sc bus. read cycles access data received from the bus. data writes to a full fifo will be ignored and data reads from an empty fifo will result in invalid data. the fifo can be cleared using the i 2cc.clear field. the data field specifies the data to be transmitted or received. bit(s) field name description type reset 31:8 reserved - write as 0, read as don't care 7:0 data writes to the register write transmit data to the fifo. reads from register reads received data from the fifo. rw 0x0 div register
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 34 ? 2012 broadcom corporation. all rights reserved synopsis the clock divider register is used to define the clock speed of the bsc peripheral. the cdiv field specifies the core clock divider used by the bsc. bit(s) field name description type reset 31:16 reserved - write as 0, read as don't care 15:0 cdiv clock divider scl = core clock / cdiv where core_clk is nominally 150 mhz. if cdiv is set to 0, the divisor is 32768. cdiv is always rounded down to an even number. the default value should result in a 100 khz i2c clock frequency. rw 0x5dc del register synopsis the data delay register provides fine control over t he sampling/launch point of the data. the redl field specifies the number core clocks to wait after the rising edge before sampling the incoming data. the fedl field specifies the number core clocks to wait after the falling edge before outputting the next data bit. note: care must be taken in choosing values for fedl and redl as it is possible to cause the bsc master to malfunction by setting values of cdiv/2 or greater. therefore the delay values should always be set to less than cd iv/2. bit(s) field name description type reset 31:16 fedl fedl falling edge delay number of core clock cycles to wait after the falling edge of scl before outputting next bit of data. rw 0x30 15:0 redl redl rising edge delay number of core clock cycles to wait after the rising edge of scl before reading the next bit of data. rw 0x30 clkt register
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 35 ? 2012 broadcom corporation. all rights reserved synopsis the clock stretch timeout register provides a timeout on how long the master waits for the slave to stretch the clock before deciding that t he slave has hung. the tout field specifies the number i2c scl clocks to wait after releasing scl high and finding that the scl is still low before decidi ng that the slave is not responding and moving the i2c machine forward. when a timeout occurs, the i2cs.clkt bit is set. writing 0x0 to tout will result in the clock stretch timeout being disabled. bit(s) field name description type reset 31:16 reserved - write as 0, read as don't care 15:0 tout tout clock stretch timeout value number of scl clock cycles to wait after the rising edge of scl before deciding that the slave is not responding. rw 0x40
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 36 ? 2012 broadcom corporation. all rights reserved 3.3 10 bit addressing 10 bit addressing is an extension to the standard 7-bit addres sing mode. this section describes in detail how to read/write using 10-bit addressing wit h this i2c controller. 10-bit addressing is compatible with, and can be combined with , 7 bit addressing. using 10 bits for addressing exploits the reserved combination 1111 0xx fo r the first byte following a start (s) or repeated start (sr) condition. the 10 bit slave address is formed from the first two byte s following a s or sr condition. the first seven bits of the first byte are the combina tion 11110xx of which the last two bits (xx) are the two most significant bits of the 10-bit address. the eighth bit of the first by te is the r/w bit. if the r/w bit is ?0? (write) then the fo llowing byte contains the remaining 8 bits of the 10-bit address. if the r/w bit is ?1? then the next byte contains data transmitted from the slave to the master. writing figure 3-1 write to a slave with 10 bit address figure 3-1 shows a write to a slave with a 10-bit address, t o perform this using the controller one must do the following: assuming we are in the ?stop? state: (and the fifo is e mpty) 1. write the number of data bytes to written (plus one) to t he i2cdlen register. 2. write ?xxxxxxxx? to the fifo where ?xxxxxxxx? are th e least 8 significant bits of the 10-bit slave address. 3. write other data to be transmitted to the fifo. 4. write ?11110xx? to slave address register where ?xx? are th e two most significant bits of the 10-bit address. set i2cc.read = 0 and i2cc.st = 1 , this will start a write transfer. reading stop start slave acknowledge repeat start master acknowledge slave acknowledge
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 37 ? 2012 broadcom corporation. all rights reserved figure 3-2 read from slave with 10 bit address figure 3-2 shows how a read from a slave with a 10-bit address is performed. following is the procedure for performing a read using the controller: 1. write 1 to the i2cdlen register. 2. write ?xxxxxxxx? to the fifo where ?xxxxxxxx? are th e least 8 significant bits of the 10-bit slave address. 3. write ?11110xx? to the slave address register where ?xx? ar e the two most significant bits of the 10-bit address. set i2cc.read = 0 and i2cc.st = 1 , this will start a write transfer. 4. poll the i2cs.ta bit, waiting for the transfer has started. 5. write the number of data bytes to read to the i2cdlen register. 6. set i2cc.read = 1 and i2cc.st = 1 , this will send the repeat start bit, new slave address and r/w bit (which is ?1?) initiating the read.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 38 ? 2012 broadcom corporation. all rights reserved 4 dma controller 4.1 overview the majority of hardware pipelines and peripherals within the BCM2835 are bus masters, enabling them to efficiently satisfy their own data requir ements. this reduces the requirements of the dma controller to block-to-block memo ry transfers and supporting some of the simpler peripherals. in addition, the dma con troller provides a read only prefetch mode to allow data to be brought into the l2 cache in an ticipation of its later use. beware that the dma controller is direcly connected t o the peripherals. thus the dma controller must be set-up to use the physical (harware) a ddresses of the peripherals. the BCM2835 dma controller provides a total of 16 dma channels . each channel operates independently from the others and is internally arbitrat ed onto one of the 3 system busses. this means that the amount of bandwidth that a dma channe l may consume can be controlled by the arbiter settings. each dma channel operates by loading a control block (cb) data structure from memory into internal registers. the control block defines the required dma operation. each control block can point to a further control block to be loaded and executed once the operation described in the current control block has completed. in this way a linked list of control blocks can be constructed in order to execute a sequence of dma operations without software intervention. the dma supports axi read bursts to ensure efficient exter nal sdram use. the dma control block contains a burst parameter which indicates the required burst size of certain memory transfers. in general the dma doesn?t do write burs ts, although wide writes will be done in 2 beat bursts if possible. memory-to-peripheral transfers can be paced by a data request (dreq) signal which is generated by the peripheral. the dreq signal is level sensitive and controls the dma by gating its axi bus requests. a peripheral can also provide a panic signal alongside the dreq to indicate that there is an imminent danger of fifo underflow or overflow or simila r critical situation. the panic is used to select the axi apriority level which is then pas sed out onto the axi bus so that it can be used to influence arbitration in the rest of the syste m. the allocation of peripherals to dma channels is progra mmable. the dma can deal with byte aligned transfers and will minimise bus traffic by buffering and packing misaligned accesses. each dma channel can be fully disabled via a top level pow er register to save power.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 39 ? 2012 broadcom corporation. all rights reserved 4.2 dma controller registers the dma controller is comprised of several identical d ma channels depending upon the required configuration. each individual dma channel has an i dentical register map (although lite channels have less functionality and hence less re gisters). dma channel 0 is located at the address of 0x7e007000, channel 1 at 0x7e007100, channel 2 at 0x7e007200 and so on. thus adjacent dma channels are offset by 0x100. dma channel 15 however, is physically removed from the o ther dma channels and so has a different address base of 0x7ee05000. dma channel offsets dma channels 0 C 14 register set offsets from dma0_base 0x000 dma channel 0 register set 0x100 dma channel 1 register set 0x200 dma channel 2 register set 0x300 dma channel 3 register set 0x400 dma channel 4 register set 0x500 dma channel 5 register set 0x600 dma channel 6 register set 0x700 dma channel 7 register set 0x800 dma channel 8 register set 0x900 dma channel 9 register set 0xa00 dma channel 10 register set 0xb00 dma channel 11 register set 0xc00 dma channel 12 register set 0xd00 dma channel 13 register set 0xe00 dma channel 14 register set dma channel 15 register set offset from dma15_base 0x000 dma channel 15 register set table 4-1 C dma controller register address map
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 40 ? 2012 broadcom corporation. all rights reserved 4.2.1 dma channel register address map each dma channel has an identical register map, only the base address of each channel is different. there is a global enable register at the top of the addr ess map that can disable each dma for powersaving. only three registers in each channels register set are directly writeable (cs, conblk_ad and debug ). the other registers (ti, source_ad, dest_ad, txfr_le n, stride & nextconbk), are automatically loaded from a control block data structure held in external memory. 4.2.1.1 control block data structure control blocks (cb) are 8 words (256 bits) in length and mu st start at a 256-bit aligned address. the format of the cb data structure in memory, is shown below. each 32 bit word of the control block is automatically loa ded into the corresponding 32 bit dma control block register at the start of a dma tran sfer. the descriptions of these registers also defines the corresponding bit locations in the cb data structure in memory. 32 - bit word offset description associated read-only register 0 transfer information ti 1 source address source_ad 2 destination address dest_ad 3 transfer length txfr_len 4 2d mode stride stride 5 next control block address nextconbk 6 - 7 reserved C set to zero. n/a table 4-2 C dma control block definition the dma is started by writing the address of a cb structure into the conblk_ad register and then setting the active bit. the dma will fetch t he cb from the address set in the scb_addr field of this reg and it will load it into the read-only registers described below. it will then begin a dma transfer according to the in formation in the cb. when it has completed the current dma transfer (length => 0) the dma will update the conblk_ad register with the contents of the nextcon bk register, fetch a new cb from that address, and start the whole procedure once again. the dma will stop (and clear the active bit) when it ha s completed a dma transfer and the nextconbk register is set to 0x0000_0000 . it will load this value into the conblk_ad reg and then stop.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 41 ? 2012 broadcom corporation. all rights reserved most of the control block registers cannot be written to directly as they loaded automatically from memory. they can be read to provide status informatio n, and to indicate the progress of the current dma transfer. the value loaded into the n extconbk register can be overwritten so that the linked list of control block da ta structures can be dynamically altered. however it is only safe to do this when the dma is pause d. 4.2.1.2 register map dma address map address offset register name description size 0x0 0_cs dma channel 0 control and status 32 0x4 0_conblk_ad dma channel 0 control block address 32 0x8 0_ti dma channel 0 cb word 0 (transfer information) 32 0xc 0_source_ad dma channel 0 cb word 1 (source address) 32 0x10 0_dest_ad dma channel 0 cb word 2 (destination address) 32 0x14 0_txfr_len dma channel 0 cb word 3 (transfer length) 32 0x18 0_stride dma channel 0 cb word 4 (2d stride) 32 0x1c 0_nextconbk dma channel 0 cb word 5 (next cb address) 32 0x20 0_debug dma channel 0 debug 32 0x100 1_cs dma channel 1 control and status 32 0x104 1_conblk_ad dma channel 1 control block address 32 0x108 1_ti dma channel 1 cb word 0 (transfer information) 32 0x10c 1_source_ad dma channel 1 cb word 1 (source address) 32 0x110 1_dest_ad dma channel 1 cb word 2 (destination address) 32 0x114 1_txfr_len dma channel 1 cb word 3 (transfer length) 32
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 42 ? 2012 broadcom corporation. all rights reserved 0x118 1_stride dma channel 1 cb word 4 (2d stride) 32 0x11c 1_nextconbk dma channel 1 cb word 5 (next cb address) 32 0x120 1_debug dma channel 1 debug 32 0x200 2_cs dma channel 2 control and status 32 0x204 2_conblk_ad dma channel 2 control block address 32 0x208 2_ti dma channel 2 cb word 0 (transfer information) 32 0x20c 2_source_ad dma channel 2 cb wo rd 1 (source address) 32 0x210 2_dest_ad dma channel 2 cb word 2 (destination address) 32 0x214 2_txfr_len dma channel 2 cb word 3 (transfer length) 32 0x218 2_stride dma channel 2 cb word 4 (2d stride) 32 0x21c 2_nextconbk dma channel 2 cb word 5 (next cb address) 32 0x220 2_debug dma channel 2 debug 32 0x300 3_cs dma channel 3 control and status 32 0x304 3_conblk_ad dma channel 3 control block address 32 0x308 3_ti dma channel 3 cb word 0 (transfer information) 32 0x30c 3_source_ad dma channel 3 cb word 1 (source address) 32 0x310 3_dest_ad dma channel 3 cb word 2 (destination address) 32 0x314 3_txfr_len dma channel 3 cb word 3 (transfer length) 32 0x318 3_stride dma channel 3 cb word 4 (2d stride) 32 0x31c 3_nextconbk dma channel 3 cb word 5 (next cb address) 32 0x320 3_debug dma channel 0 debug 32
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 43 ? 2012 broadcom corporation. all rights reserved 0x400 4_cs dma channel 4 control and status 32 0x404 4_conblk_ad dma channel 4 control block address 32 0x408 4_ti dma channel 4 cb word 0 (transfer information) 32 0x40c 4_source_ad dma channel 4 cb word 1 (source address) 32 0x410 4_dest_ad dma channel 4 cb word 2 (destination address) 32 0x414 4_txfr_len dma channel 4 cb word 3 (transfer length) 32 0x418 4_stride dma channel 4 cb word 4 (2d stride) 32 0x41c 4_nextconbk dma channel 4 cb word 5 (next cb address) 32 0x420 4_debug dma channel 0 debug 32 0x500 5_cs dma channel 5 control and status 32 0x504 5_conblk_ad dma channel 5 control block address 32 0x508 5_ti dma channel 5 cb word 0 (transfer information) 32 0x50c 5_source_ad dma channel 5 cb word 1 (source address) 32 0x510 5_dest_ad dma channel 5 cb word 2 (destination address) 32 0x514 5_txfr_len dma channel 5 cb word 3 (transfer length) 32 0x518 5_stride dma channel 5 cb word 4 (2d stride) 32 0x51c 5_nextconbk dma channel 5 cb word 5 (next cb address) 32 0x520 5_debug dma channel 5 debug 32 0x600 6_cs dma channel 6 control and status 32 0x604 6_conblk_ad dma channel 6 control block address 32 0x608 6_ti dma channel 6 cb word 0 (transfer information) 32
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 44 ? 2012 broadcom corporation. all rights reserved 0x60c 6_source_ad dma channel 6 cb word 1 (source address) 32 0x610 6_dest_ad dma channel 6 cb word 2 (destination address) 32 0x614 6_txfr_len dma channel 6 cb word 3 (transfer length) 32 0x618 6_stride dma channel 6 cb word 4 (2d stride) 32 0x61c 6_nextconbk dma channel 6 cb word 5 (next cb address) 32 0x620 6_debug dma channel 6 debug 32 0x700 7_cs dma channel 7 control and status 32 0x704 7_conblk_ad dma channel 7 control block address 32 0x708 7_ti dma channel 7 cb word 0 (transfer information) 32 0x70c 7_source_ad dma channel 7 cb word 1 (source address) 32 0x710 7_dest_ad dma channel 7 cb word 2 (destination address) 32 0x714 7_txfr_len dma channel 7 cb word 3 (transfer length) 32 0x71c 7_nextconbk dma channel 7 cb word 5 (next cb address) 32 0x720 7_debug dma channel 7 debug 32 0x800 8_cs dma channel 8 control and status 32 0x804 8_conblk_ad dma channel 8 control block address 32 0x808 8_ti dma channel 8 cb word 0 (transfer information) 32 0x80c 8_source_ad dma channel 8 cb word 1 (source address) 32 0x810 8_dest_ad dma channel 8 cb word 2 (destination address) 32 0x814 8_txfr_len dma channel 8 cb word 3 (transfer length) 32 0x81c 8_nextconbk dma channel 8 cb word 5 (next cb address) 32
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 45 ? 2012 broadcom corporation. all rights reserved 0x820 8_debug dma channel 8 debug 32 0x900 9_cs dma channel 9 control and status 32 0x904 9_conblk_ad dma channel 9 control block address 32 0x908 9_ti dma channel 9 cb word 0 (transfer information) 32 0x90c 9_source_ad dma channel 9 cb word 1 (source address) 32 0x910 9_dest_ad dma channel 9 cb word 2 (destination address) 32 0x914 9_txfr_len dma channel 9 cb word 3 (transfer length) 32 0x91c 9_nextconbk dma channel 9 cb word 5 (next cb address) 32 0x920 9_debug dma channel 9 debug 32 0xa00 10_cs dma channel 10 control and status 32 0xa04 10_conblk_ad dma channel 10 control block address 32 0xa08 10_ti dma channel 10 cb word 0 (transfer information) 32 0xa0c 10_source_ad dma channel 10 cb word 1 (source address) 32 0xa10 10_dest_ad dma channel 10 cb word 2 (destination address) 32 0xa14 10_txfr_len dma channel 10 cb word 3 (transfer length) 32 0xa1c 10_nextconbk dma channel 10 cb word 5 (next cb address) 32 0xa20 10_debug dma channel 10 debug 32 0xb00 11_cs dma channel 11 control and status 32 0xb04 11_conblk_ad dma channel 11 control block address 32 0xb08 11_ti dma channel 11 cb word 0 (transfer information) 32 0xb0c 11_source_ad dma channel 11 cb word 1 (source address) 32
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 46 ? 2012 broadcom corporation. all rights reserved 0xb10 11_dest_ad dma channel 11 cb word 2 (destination address) 32 0xb14 11_txfr_len dma channel 11 cb word 3 (transfer length) 32 0xb1c 11_nextconbk dma channel 11 cb word 5 (next cb address) 32 0xb20 11_debug dma channel 11 debug 32 0xc00 12_cs dma channel 12 control and status 32 0xc04 12_conblk_ad dma channel 12 control block address 32 0xc08 12_ti dma channel 12 cb word 0 (transfer information) 32 0xc0c 12_source_ad dma channel 12 cb word 1 (source address) 32 0xc10 12_dest_ad dma channel 12 cb word 2 (destination address) 32 0xc14 12_txfr_len dma channel 12 cb word 3 (transfer length) 32 0xc1c 12_nextconbk dma channel 12 cb word 5 (next cb address) 32 0xc20 12_debug dma channel 12 debug 32 0xd00 13_cs dma channel 13 control and statu s 32 0xd04 13_conblk_ad dma channel 13 control block address 32 0xd08 13_ti dma channel 13 cb word 0 (transfer information) 32 0xd0c 13_source_ad dma channel 13 cb word 1 (source address) 32 0xd10 13_dest_ad dma channel 13 cb word 2 (destination address) 32 0xd14 13_txfr_len dma channel 13 cb word 3 (transfer length) 32 0xd1c 13_nextconbk dma channel 13 cb word 5 (next cb address) 32 0xd20 13_debug dma channel 13 debug 32 0xe00 14_cs dma channel 14 control and status 32
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 47 ? 2012 broadcom corporation. all rights reserved 0xe04 14_conblk_ad dma channel 14 control block address 32 0xe08 14_ti dma channel 14 cb word 0 (transfer information) 32 0xe0c 14_source_ad dma channel 14 cb word 1 (source address) 32 0xe10 14_dest_ad dma channel 14 cb word 2 (destination address) 32 0xe14 14_txfr_len dma channel 14 cb word 3 (transfer length) 32 0xe1c 14_nextconbk dma channel 14 cb word 5 (next cb address) 32 0xe20 14_debug dma channel 14 debug 32 0xfe0 int_status interrupt status of each dma channel 32 0xff0 enable global enable bits for each dma channel 32 0_cs 1_cs 2_cs 3_cs 4_cs 5_cs 6_cs 7_cs 8_cs 9_cs 1 0_cs 11_cs 12_cs 13_cs 14_cs register synopsis dma control and status register contains the main c ontrol and status bits for this dma channel. bit(s) field name description type reset 31 reset dma channel reset writing a 1 to this bit will reset the dma. the bit cannot be read, and will self clear. w1sc 0x0 30 abort abort dma writing a 1 to this bit will abort the current dma cb. the dma will load the next cb and attempt to continue. the bit cannot be read, and will self clear. w1sc 0x0 29 disdebug disable debug pause signal when set to 1, the dma will not stop when the debug pause signal is asserted. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 48 ? 2012 broadcom corporation. all rights reserved 28 wait_for_outstanding_writes wait for outstanding writes when set to 1, the dma will keep a tally of the axi writes going out and the write responses coming in. at the very end of the current dma transfer it will wait until the last outstanding write response has been received before indicating the transfer is complete. whilst waiting it will load the next cb address (but will not fetch the cb), clear the active flag (if the next cb address = zero), and it will defer setting the end flag or the int flag until the last outstanding write response has been received. in this mode, the dma will pause if it has more than 13 outstanding writes at any one time. rw 0x0 27: 24 reserved - write as 0, read as don't care 23:20 panic_priority axi panic priority level sets the priority of panicking axi bus transactions. this value is used when the panic bit of the selected peripheral channel is 1. zero is the lowest priority. rw 0x0 19:16 priority axi priority level sets the priority of normal axi bus transactions. this value is used when the panic bit of the selected peripheral channel is zero. zero is the lowest priority. rw 0x0 15:9 reserved - write as 0, read as don't care 8 error dma error indicates if the dma has detected an error. the error flags are available in the debug register, and have to be cleared by writing to that register. 1 = dma channel has an error flag set. 0 = dma channel is ok. ro 0x0 7 reserved - write as 0, read as don't care
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 49 ? 2012 broadcom corporation. all rights reserved 6 waiting_for_outstanding_writes dma is waiting for the last write to be received indicates if the dma is currently waiting for any outstanding writes to be received, and is not transferring data. 1 = dma channel is waiting. ro 0x0 5 dreq_stops_dma dma paused by dreq state indicates if the dma is currently paused and not transferring data due to the dreq being inactive.. 1 = dma channel is paused. 0 = dma channel is running. ro 0x0 4 paused dma paused state indicates if the dma is currently paused and not transferring data. this will occur if: the active bit has been cleared, if the dma is currently executing wait cycles or if the debug_pause signal has been set by the debug block, or the number of outstanding writes has exceeded the max count. 1 = dma channel is paused. 0 = dma channel is running. ro 0x0 3 dreq dreq state indicates the state of the selected dreq (data request) signal, ie. the dreq selected by the permap field of the transfer info. 1 = requesting data. this will only be valid once the dma has started and the permap field has been loaded from the cb. it will remain valid, indicating the selected dreq signal, until a new cb is loaded. if permap is set to zero (un- paced transfer) then this bit will read back as 1. 0 = no data request. ro 0x0 2 int interrupt status this is set when the transfer for the cb ends and inten is set to 1. once set it must be manually cleared down, even if the next cb has inten = 0. write 1 to clear. w1c 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 50 ? 2012 broadcom corporation. all rights reserved 1 end dma end flag set when the transfer described by the current control block is complete. write 1 to clear. w1c 0x0 0 active activate the dma this bit enables the dma. the dma will start if this bit is set and the cb_addr is non zero. the dma transfer can be paused and resumed by clearing, then setting it again. this bit is automatically cleared at the end of the complete dma transfer, ie. after a nextconbk = 0x0000_0000 has been loaded. rw 0x0 0_conblk_ad 1_conblk_ad 2_conblk_ ad 3_conblk_ad 4_conblk_ad 5_conblk_ad 6_conblk_ad 7_conblk_ad 8_conblk_ad 9_conblk_ad 10_ conblk_ad 11_conblk_ad 12_conblk_ad 13_conblk_ad 14_conblk_ad register synopsis dma control block address register. bit(s) field name description type reset 31:0 scb_addr control block address this tells the dma where to find a control block stored in memory. when the active bit is set and th is address is non zero, the dma will begin its transfe r by loading the contents of the addressed cb into the relevant dma channel registers. at the end of the transfer this register will be up dated with the addr field of the nextconbk control block register. if this field is zero, the dma will stop. reading this register will return the address of th e currently active cb (in the linked list of cb s). t he address must be 256 bit aligned, so the bottom 5 bi ts of the address must be zero. rw 0x0 0_ti 1_ti 2_ti 3_ti 4_ti 5_ti 6_ti register synopsis dma transfer information. bit(s) field name description type reset
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 51 ? 2012 broadcom corporation. all rights reserved 31:27 reserved - write as 0, read as don't care 26 no_wide_bursts don t do wide writes as a 2 beat burst this prevents the dma from issuing wide writes as 2 beat axi bursts. this is an inefficient access mode , so the default is to use the bursts. rw 0x0 25:21 waits add wait cycles this slows down the dma throughput by setting the number of dummy cycles burnt after each dma read or write operation is completed. a value of 0 means that no wait cycles are to be added. rw 0x0 20:16 permap peripheral mapping indicates the peripheral number (1-31) whose ready signal shall be used to control the rate of the transfers, and whose panic signals will be output o n the dma axi bus. set to 0 for a continuous un-paced transfer. rw 0x0 15:12 burst_length burst transfer length indicates the burst length of the dma transfers. th e dma will attempt to transfer data as bursts of this number of words. a value of zero will produce a sin gle transfer. bursts are only produced for specific conditions, see main text. rw 0x0 11 src _ignore ignore reads 1 = do not perform source reads. in addition, destination writes will zero all the write strobes. this is used for fast cache fill operations. 0 = perform source reads.. rw 0x0 10 src_dreq control source reads with dreq 1 = the dreq selected by per_map will gate the source reads. 0 = dreq has no effect. rw 0x0 9 src_width source transfer width 1 = use 128-bit source read width. 0 = use 32-bit source read width. rw 0x0 8 src_inc source address increment 1 = source address increments after each read. the address will increment by 4, if s_width=0 else by 3 2. 0 = source address does not change. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 52 ? 2012 broadcom corporation. all rights reserved 7 dest_ignore ignore writes 1 = do not perform destination writes. 0 = write data to destination. rw 0x0 6 dest_dreq control destination writes with dreq 1 = the dreq selected by permap will gate the destination writes. 0 = dreq has no effect. rw 0x0 5 dest_width destination transfer width 1 = use 128-bit destination write width. 0 = use 32-bit destination write width. rw 0x0 4 dest_inc destination address increment 1 = destination address increments after each write the address will increment by 4, if dest_width=0 else by 32. 0 = destination address does not change. rw 0x0 3 wait_resp wait for a write response when set this makes the dma wait until it receives the axi write response for each write. this ensures that multiple writes cannot get stacked in the axi bus pipeline. 1= wait for the write response to be received befor e proceeding. 0 = don t wait; continue as soon as the write data is sent. rw 0x0 2 reserved - write as 0, read as don't care 1 tdmode 2d mode 1 = 2d mode interpret the txfr_len register as ylength number of transfers each of xlength, and add the strides to the address after each transfer. 0 = linear mode interpret the txfr register as a si ngle transfer of total length {ylength ,xlength}. rw 0x0 0 inten interrupt enable 1 = generate an interrupt when the transfer describ ed by the current control block completes. 0 = do not generate an interrupt. rw 0x0 0_source_ad 1_source_ad 2_source_ad 3_source_ad 4_s ource_ad 5_source_ad 6_source_ad 7_source_ad 8_source_ad 9_source_ad 10_ source_ad 11_source_ad 12_source_ad 13_source_ad 14_source_ad register
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 53 ? 2012 broadcom corporation. all rights reserved synopsis dma source address bit(s) field name description type reset 31:0 s_addr dma source address source address for the dma operation. updated by the dma engine as the transfer progresses. rw 0x0 0_dest_ad 1_dest_ad 2_dest_ad 3_dest_ad 4_dest_ad 5 _dest_ad 6_dest_ad 7_dest_ad 8_dest_ad 9_dest_ad 10_dest_ad 11_dest_ad 12_dest_ad 13_dest_ad 14_dest_ad register synopsis dma destination address bit(s) field name description type reset 31:0 d_addr dma destination address destination address for the dma operation. updated by the dma engine as the transfer progresses. rw 0x0 0_txfr_len 1_txfr_len 2_txfr_len 3_txfr_len 4_txfr_ len 5_txfr_len 6_txfr_len register synopsis dma transfer length. this specifies the amount of d ata to be transferred in bytes. in normal (non 2d) mode this specifies the amount o f bytes to be transferred. in 2d mode it is interpreted as an x and a y length , and the dma will perform y transfers, each of length x bytes and add the strides onto the addr esses after each x leg of the transfer. the length register is updated by the dma engine as the transfer progresses, so it will indicate the data left to transfer. bit(s) field name description type reset 31:30 reserved - write as 0, read as don't care 29:16 ylength when in 2d mode, this is the y transfer length, indicating how many xlength transfers are performed . when in normal linear mode this becomes the top bit s of the xlength rw 0x0 15:0 xlength transfer length in bytes. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 54 ? 2012 broadcom corporation. all rights reserved 0_stride 1_stride 2_stride 3_stride 4_stride 5_stri de 6_stride register synopsis dma 2d stride bit(s) field name description type reset 31:16 d_stride destination stride (2d mode) signed (2 s complement) byte increment to apply to the destination address at the end of each row in 2 d mode. rw 0x0 15:0 s_stride source stride (2d mode) signed (2 s complement) byte increment to apply to the source address at the end of each row in 2d mode. rw 0x0 0_nextconbk 1_nextconbk 2_nextconbk 3_nextconbk 4_n extconbk 5_nextconbk 6_nextconbk 7_nextconbk 8_nextconbk 9_nextconbk 10_ nextconbk 11_nextconbk 12_nextconbk 13_nextconbk 14_nextconbk register synopsis dma next control block address the value loaded into this register can be overwrit ten so that the linked list of control block data structures can be altered. however it is only safe to do this when the dma is paused. the address must be 256 bit aligned and so the bottom 5 bits cannot be set and will read back as zero. bit(s) field name description type reset 31:0 addr address of next cb for chained dma operations. rw 0x0 0_debug 1_debug 2_debug 3_debug 4_debug 5_debug 6_d ebug register synopsis dma debug register. bit(s) field name description type reset 31:29 reserved - write as 0, read as don't care
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 55 ? 2012 broadcom corporation. all rights reserved 28 lite dma lite set if the dma is a reduced performance lite engine. ro 0x0 27:25 version dma version dma version number, indicating control bit filed changes. ro 0x2 24:16 dma_state dma state machine state returns the value of the dma engines state machine for this channel. ro 0x0 15:8 dma_id dma id returns the dma axi id of this dma channel. ro 0x0 7:4 outstanding_writes dma outstanding writes counter returns the number of write responses that have not yet been received. this count is reset at the start of each new dma transfer or with a dma reset. ro 0x0 3 reserved - writ e as 0, read as don't care 2 read_error slave read response error set if the read operation returned an error value o n the read response bus. it can be cleared by writing a 1, rw 0x0 1 fifo_error fifo error set if the optional read fifo records an error condition. it can be cleared by writing a 1, rw 0x0 0 read_last_not_set_error read last not set error if the axi read last signal was not set when expected, then this error bit will be set. it can b e cleared by writing a 1. rw 0x0 7_ti 8_ti 9_ti 10_ti 11_ti 12_ti 13_ti 14_ti regist er synopsis dma transfer information. bit(s) field name description type reset 31:26 reserved - write as 0, read as don't care
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 56 ? 2012 broadcom corporation. all rights reserved 25:21 waits add wait cycles this slows down the dma throughput by setting the number of dummy cycles burnt after each dma read or write operation is completed. a value of 0 means that no wait cycles are to be added. rw 0x0 20:16 permap peripheral mapping indicates the peripheral number (1-31) whose ready signal shall be used to control the rate of the transfers, and whose panic signals will be output o n the dma axi bus. set to 0 for a continuous un-paced transfer. rw 0x0 15:12 burst_length burst transfer length indicates the burst length of the dma transfers. th e dma will attempt to transfer data as bursts of this number of words. a value of zero will produce a sin gle transfer. bursts are only produced for specific conditions, see main text. rw 0x0 11 src_ignore rw 0x0 10 src_dreq control source reads with dreq 1 = the dreq selected by per_map will gate the source reads. 0 = dreq has no effect. rw 0x0 9 src_width source transfer width 1 = use 128-bit source read width. 0 = use 32-bit source read width. rw 0x0 8 src_inc source address increment 1 = source address increments after each read. the address will increment by 4, if s_width=0 else by 3 2. 0 = source address does not change. rw 0x0 7 dest_ignore rw 0x0 6 dest_dreq control destination writes with dreq 1 = the dreq selected by permap will gate the destination writes. 0 = dreq has no effect. rw 0x0 5 dest_width destination transfer width 1 = use 128-bit destination write width. 0 = use 32-bit destination write width. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 57 ? 2012 broadcom corporation. all rights reserved 4 dest_inc destination address increment 1 = destination address increments after each write the address will increment by 4, if dest_width=0 else by 32. 0 = destination address does not change. rw 0x0 3 wait_resp wait for a write response when set this makes the dma wait until it receives the axi write response for each write. this ensures that multiple writes cannot get stacked in the axi bus pipeline. 1= wait for the write response to be received befor e proceeding. 0 = don t wait; continue as soon as the write data is sent. rw 0x0 2:1 reserved - write as 0, read as don't care 0 inten interrupt enable 1 = generate an interrupt when the transfer describ ed by the current control block completes. 0 = do not generate an interrupt. rw 0x0 7_txfr_len 8_txfr_len 9_txfr_len 10_txfr_len 11_txf r_len 12_txfr_len 13_txfr_len 14_txfr_len register synopsis dma transfer length bit(s) field name description type reset 31:16 reserved - write as 0, read as don't care 15:0 xlength transfer length length of transfer, in bytes. updated by the dma engine as the transfer progresses. rw 0x0 7_debug 8_debug 9_debug 10_debug 11_debug 12_debug 13_debug 14_debug register synopsis dma lite debug register. bit(s) field name description type reset
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 58 ? 2012 broadcom corporation. all rights reserved 31:29 reserved - write as 0, read as don't care 28 lite dma lite set if the dma is a reduced performance lite engine. ro 0x1 27:25 version dma version dma version number, indicating control bit filed changes. ro 0x2 24:16 dma_state dma state machine state returns the value of the dma engines state machine for this channel. ro 0x0 15:8 dma_id dma id returns the dma axi id of this dma channel. ro 0x0 7:4 outstanding_writes dma outstanding writes counter returns the number of write responses that have not yet been received. this count is reset at the start of each new dma transfer or with a dma reset. ro 0x0 3 reserved - write as 0, read as don't care 2 read_error slave read response error set if the read operation returned an error value o n the read response bus. it can be cleared by writing a 1, rw 0x0 1 fifo_error fifo error set if the optional read fifo records an error condition. it can be cleared by writing a 1, rw 0x0 0 read_last_not_set_error read last not set error if the axi read last signal was not set when expected, then this error bit will be set. it can b e cleared by writing a 1. rw 0x0 int_status register synopsis interrupt status of each dma engine bit(s) field name description type reset
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 59 ? 2012 broadcom corporation. all rights reserved 31:16 reserved - write as 0, read as don't care 15 int15 interrupt status of dma engine 15 rw 0x0 14 int14 interrupt status of dma engine 14 rw 0x0 13 int13 interrupt status of dma engine 13 rw 0x0 12 int12 interrupt status of dma engine 12 rw 0x0 11 int11 interrupt status of dma engine 11 rw 0x0 10 int10 interrupt status of dma engine 10 rw 0x0 9 int9 interrupt status of dma engine 9 rw 0x0 8 int8 interrupt status of dma engine 8 rw 0x0 7 int7 interrupt status of dma engine 7 rw 0x0 6 int6 interrupt status of dma engine 6 rw 0x0 5 int5 interrupt status of dma engine 5 rw 0x0 4 int4 interrupt status of dma engine 4 rw 0x0 3 int3 interrupt status of dma engine 3 rw 0x0 2 int2 interrupt status of dma engine 2 rw 0x0 1 int1 interrupt status of dma engine 1 rw 0x0 0 int0 interrupt status of dma engine 0 rw 0x0 enable register synopsis global enable bits for each channel bit(s) field name description type reset 31:15 reserved - write as 0, read as don't care
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 60 ? 2012 broadcom corporation. all rights reserved 14 en14 enable dma engine 14 rw 0x1 13 en13 enable dma engine 13 rw 0x1 12 en12 enable dma engine 12 rw 0x1 11 en11 enable dma engine 11 rw 0x1 10 en10 enable dma engine 10 rw 0x1 9 en9 enable dma engine 9 rw 0x1 8 en8 enable dma engine 8 rw 0x1 7 en7 enable dma engine 7 rw 0x1 6 en6 enable dma engine 6 rw 0x1 5 en5 enable dma engine 5 rw 0x1 4 en4 enable dma engine 4 rw 0x1 3 en3 enable dma engine 3 rw 0x1 2 en2 enable dma engine 2 rw 0x1 1 en1 enable dma engine 1 rw 0x1 0 en0 enable dma engine 0 rw 0x1
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 61 ? 2012 broadcom corporation. all rights reserved 4.2.1.3 peripheral dreq signals a dreq (data request) mechanism is used to pace the dat a flow between the dma and a peripheral. each peripheral is allocated a permanent dreq signal. e ach dma channel can select which of the dreq signals should be used to pace the transfer by controlling the dma reads, dma writes or both. note that dreq 0 is permanently enabled and can be used if no dreq is required. when a dreq signal is being used to pace the dma reads, t he dma will wait until it has sampled dreq high before launching a single or burst read ope ration. it will then wait for all the read data to be returned before re-checking the dreq an d starting the next read. thus once a peripheral receives the read request it should re move its dreq as soon as possible to prevent the dma from re-sampling the same dreq asserti on. dreq?s are not required when reading from axi peripherals. in this case, the dma will request data from the peripheral and the peripheral will only send the data when it is available. the dma will not request data that is does n ot have room for, so no pacing of the data flow is required. dreq?s are required when reading from apb peripherals as the axi-to-apb bridge will not wait for an apb peripheral to be ready and will just pe rfom the apb read regardless. thus an apb peripheral needs to make sure that it has all of its read data ready before it drives its dreq high. when writing to peripherals, a dreq is always required t o pace the data. however, due to the pipelined nature of the axi bus system, several wri tes may be in flight before the peripheral receives any data and withdraws its dreq signa l. thus the peripheral must ensure that it has sufficient room in its input fifo to a ccommodate the maximum amount of data that it might receive. if the peripheral is una ble to do this, the dma wait_resp mechanism can be used to ensure that only one write is in flight at any one time, however this is less efficient transfer mechanism. the mapping of peripherals to dreq?s is as follows: dreq peripheral 0 dreq = 1 this is always on so use this channel if no dreq is required. 1 dsi 2 pcm tx 3 pcm rx 4 smi 5 pwm 6 spi tx 7 spi rx
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 62 ? 2012 broadcom corporation. all rights reserved 8 bsc/spi slave tx 9 bsc/spi slave rx 10 unused 11 e.mmc 12 uart tx 13 sd host 14 uart rx. 15 dsi 16 slimbus mctx. 17 hdmi 18 slimbus mcrx 19 slimbus dc0 20 slimbus dc1 21 slimbus dc2 22 slimbus dc3 23 slimbus dc4 24 scaler fifo 0 & smi * 25 scaler fifo 1 & smi * 26 scaler fifo 2 & smi * 27 slimbus dc5 28 slimbus dc6 29 slimbus dc7 30 slimbus dc8 31 slimbus dc9 * the smi element of the scaler fifo 0 & smi dreqs c an be disabled by setting the smi_disable bit in the dma_dreq_control register in the sy stem arbiter control block.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 63 ? 2012 broadcom corporation. all rights reserved 4.3 axi bursts the dma supports bursts under specific conditions. up to 16 beat bursts can be accommodated. peripheral (32 bit wide) read bursts are supported. the dm a will generate the burst if there is sufficient room in its read buffer to accommodate al l the data from the burst. this limits the burst size to a maximum of 8 beats. read bursts in destination ignore mode (dest_ignore) are s upported as there is no need for the dma to deal with the data. this allows wide bur sts of up to 16 beats to be used for efficient l2 cache fills. dma channel 0 and 15 are fitted with an external 128 bit 8 word r ead fifo. this enables efficient memory to memory transfers to be performed. this fifo allows the dma to accommodate a wide read burst up to the size of the fifo . in practice this will allow a 128 bit wide read burst of 9 as the first word back will be imm ediately read into the dma engine (or a 32 bit peripheral read burst of 16 ? 8 in the input buffer a nd 8 in the fifo). on any dma channel, if a read burst is selected that is too large, th e axi read bus will be stalled until the dma has written out the data. this may lead to ineffic ient system operation, and possibly axi lock up if it causes a circular dependancy. in general write bursts are not supported. however to i ncrease the efficiency of l2 cache fills, src_ignore (src_ignore) transfers can be speci fied with a write burst. in this case the dma will issue a write burst address sequence followed by the appropriate number of zero data, zero strobe write bus cycles, which will ca use the cache to pre-fetch the data. to improve the efficiency of the 128 bit wide bus architecture, and to make use of the dmas internal 256 bit registers, the dma will generate 128 bit wi de writes as 2 beat bursts wherever possible, although this behaviour can be disabled. 4.4 error handling if the dma detects a read response error it will record the fact in the read_error flag in the debug register. this will remain set until it is c leared by writing a 1 to it. the dma will clear its active flag and generate an interrupt. a ny outstanding read data transactions (remainder of a burst) will be honoured. this allows the operator to either restart the dma by clearing the error bit and setting the active bit, or to abort the dma transfer by clearing the nextconbk register and restarting the dma with th e abort bit set. the dma will also record any errors from an external r ead fifo. these will be latched in the fifo_error bit in the debug register until they are cl eared by writing a ?1? to the bit. (note that only dma0 and 15 have an external read fifo) if the dma detects that a read occurred without the axi rlast set as expected then it will set the read_last_not_set_error bit in the debug register. thi s can be cleared by writing a ?1? to it. the error bits are logically or?d together and presented as a general error bit in the cs register. 4.5 dma lite engines several of the dma engines are of the lite design. thi s is a reduced specification engine designed to save space. the engine behaves in the same way as a normal dma engine except for the following differences.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 64 ? 2012 broadcom corporation. all rights reserved 1. the internal data structure is 128 bits instead of 256 bits. this means that if you do a 128 bit wide read burst of more than 1 beat, the dma input r egister will be full and the read bus will be stalled. the normal dma engine can accept a read burst of 2 without stalling. if you do a narrow 32 bit read burst fro m the peripherals then the lite engine can cope with a burst of 4 as opposed to a burst of 8 for the normal engine. note that stalling the read bus will potential ly reduce the overall system performance, and may possible cause a system lockup if y ou end up with a conflict where the dma cannot free the read bus as the read stal l has prevented it writing out its data due to some circular system relationship. 2. the lite engine does not support 2d transfers. the tdmode , s_stride, d_stride and ylength registers will all be removed. se tting these registers will have no effect. 3. the dma length register is now 16 bits, limiting the maxim um transferrable length to 65536 bytes. 4. source ignore (src_ignore) and destination ignore (dest_ ignore) modes are removed. the lite engine will have about half the bandwidth of a normal dma engine, and are intended for low bandwith peripheral servicing.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 65 ? 2012 broadcom corporation. all rights reserved 5 external mass media controller o introduction the external mass media controller (emmc) is an embe dded multimedia ? and sd ? card interface provided by arasan ? . it is compliant to the following standards: ? sd ? host controller standard specification version 3.0 draft 1.0 ? sdio ? card specification version 3.0 ? sd ? memory card specification draft version 3.0 ? sd ? memory card security specification version 1.01 ? mmc ? specification version 3.31,4.2 and 4.4 for convenience in the following text card is used as a p laceholder for sd?, embedded multimedia and sdio? cards. for detailed information about the emmc internals pleas e refer to the arasan? document sd3.0_host_ahb_emmc4.4_usersguide_ver5.9_jan11_10.pdf but make sure to read the following chapter which lists the changes made to arasan ??s ip. because the emmc module shares pins with other function ality it must be selected in the gpio interface. please refer to the gpio section for further details. the interface to the card uses its own clock clk_emmc whic h is provided by the clock manager module. the frequency of this clock should be sele cted between 50 mhz and 100 mhz. having a separate clock allows high performance access to the card even if the videocore runs at a reduced clock frequency. the emmc module c ontains its own internal clock divider to generate the card?s clock from clk_emmc. additionally can the sampling clock for the response and data from the card be delayed in up to 40 steps with a configurable delay between 200ps to 1100ps per ste p typically. the delay is intended to cancel the internal delay inside the card (up to 14ns) when reading. the delay per step will vary with temperature and supply voltage. the refore it is better to use a bigger delay than necessary as there is no restriction for t he maximum delay. the emmc module handles the handshaking process on the co mmand and data lines and all crc processing automatically. command execution is commenced by writing the command plus t he appropriate flags to the cmdtm register after loading any required argument into t he arg1 register. the emmc module calculates the crc checksum, transfers the comm and to the card, receives the response and checks its crc. once the command has exec uted or timed-out bit 0 of register interrupt will be set. please note that the interru pt register is not self clearing, so the software has first to reset it by writing 1 before using it to detect if a command has finished.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 66 ? 2012 broadcom corporation. all rights reserved the software is responsible for checking the status bits of the card?s response in order to verify successful processing by the card. in order to transfer data from/to the card register da ta is accessed after configuring the host and sending the according commands to the card using cmdtm. because the emmc module doesn?t interpret the commands sent to the card it is important to configure it identical to the card setup using the control0 register. e special care should be taken to make sure that the width of the data bus is configured iden tical for host and card. the card is synchronized to the data flow by switching off its clock appro priately. a handshake signal dma_req is available for paced data transfers. bit 1 of t he interrupt register can used to determine whether a data transfer has finished. please not e that the interrupt register is not self clearing, so the software has first to reset it by writing 1 before using it to detect if a data transfer has finished. the emmc module restricts the maximum block size to the size of the internal data fifo which is 1k bytes. in order to get maximum performance for data transfers it is necessary to use multiple block data transfers. in this case the emm c module uses two fifos in ping- pong mode, i.e. one is used to transfer data to/from the card while the other is simultaneously accessed by dma via the axi bus. if the emmc module is c onfigured for single block transfers only one fifo is used, so no dma access is po ssible while data is transferred to/from the card and vice versa resulting in long dead time s. o registers contrary to arasan??s documentation the emmc module r egisters can only be accessed as 32 bit registers, i.e. the two lsbs of the address are al ways zero. the emmc register base address is 0x7e300000 emmc address map address offset register name description size 0x0 arg2 acmd23 argument 32 0x4 blksizecnt block size and count 32 0x8 arg1 argument 32 0xc c mdtm command and transfer mode 32 0x10 resp0 response bits 31 : 0 32 0x14 resp1 response bits 63 : 32 32
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 67 ? 2012 broadcom corporation. all rights reserved 0x18 resp2 response bits 95 : 64 32 0x1c resp3 response bits 127 : 96 32 0x20 data data 32 0x24 status status 32 0x28 control0 host configuration bits 32 0x2c control1 host configuration bits 32 0x30 interrupt interrupt flags 32 0x34 irpt_mask interrupt flag enable 32 0x38 irpt_en interrupt generation enable 32 0x3c control2 host configuration bits 32 0x50 force_irpt force interrupt event 32 0x70 boot_timeout timeout in boot mode 32 0x74 dbg_sel debug bus configuration 32 0x80 exrdfifo_cfg extension fifo configuration 32 0x84 exrdfifo_en extension fifo enable 32 0x88 tune_step delay per card clock tuning step 32 0x8c tune_steps_std card clock tuning steps for sdr 32 0x90 tune_steps_ddr card clock tuning steps for ddr 32 0xf0 spi_int_spt spi interrupt support 32 0xfc slotisr_ver slot interrupt status and version 32 arg2 register
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 68 ? 2012 broadcom corporation. all rights reserved synopsis this register contains the argument for the sd card s pecific command acmd23 (set_wr_blk_erase_count). arg2 must be set before t he acmd23 command is issued using the cmdtm register. bit(s) field name description type reset 31:0 argument argument to be issued with acmd23 rw 0x0 blksizecnt register synopsis this register must not be accessed or modified while any data transfer between card and host is ongoing. it contains the number and size in bytes for data blo cks to be transferred. please note that the emmc module restricts the maximum block size to the size of the internal data fifo which is 1k bytes. blkcnt is used to tell the host how many blocks of dat a are to be transferred. once the data transfer has started and the tm_blkcnt_en bit in the cmdtm register is set the emmc module automatically decreases the bntcn t value as the data blocks are transferred and stops the transfer once blkcnt r eaches 0. bit(s) field name description type reset 31:16 blkcnt number of blocks to be transferred rw 0x0 15:10 reserved - write as 0, read as don't care 9:0 blksize block size in bytes rw 0x0 arg1 register synopsis this register contains the arguments for all commands except for the sd card specific command acmd23 which uses arg2. arg1 must be set befo re the command is issued using the cmdtm register. bit(s) field name description type reset 31:0 argument argument to be issued with command rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 69 ? 2012 broadcom corporation. all rights reserved cmdtm register synopsis this register is used to issue commands to the card. besides the command it also contains flags informing the emmc module what card re sponse and type of data transfer to expect. incorrect flags will result in st range behaviour. for data transfers two modes are supported: either transferring a single block of data or several blocks of the same size. the sd card uses tw o different sets of commands to differentiate between them but the host needs to be additionally configured using tm_multi_block. it is important that this bit is se t correct for the command sent to the card, i.e. 1 for cmd18 and cmd25 and 0 for cmd17 and cmd24. multiple block transfer gives a better performance. the blksizecnt register is used to configure the size and number of blocks to be transferred. if bit tm_blkcnt_en of this register i s set the transfer stops automatically after the number of data blocks configured in the blksizecnt register has been transferred. the tm_auto_cmd_en bits can be used to make the host to send automatically a command to the card telling it that the data transfer has finished once the blkcnt bits in the blksizecnt register are 0. bit(s) field name description type reset 31:30 reserved - write as 0, read as don't care 29:24 cmd_index index of the command to be issued to the card rw 0x0 23:22 cmd_type type of command to be issued to the card: 00 = normal 01 = suspend (the current data transfer) 10 = resume (the last data transfer) 11 = abort (the current data transfer) rw 0x0 21 cmd_isdata command involves data transfer: 0 = no data transfer command 1 = data transfer command rw 0x0 20 cmd_ixchk_en check that response has same index as command: 0 = disabled 1 = enabled rw 0x0 19 cmd_crcchk_en check the responses crc: 0 = disabled 1 = enabled rw 0x0 18 reserved - write as 0, read as don't care 17:16 cmd_rspns_type type of expected response from card: 00 = no response 01 = 136 bits response 10 = 48 bits response 11 = 48 bits response using busy rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 70 ? 2012 broadcom corporation. all rights reserved 15:6 reserved - write as 0, read as don't care 5 tm_multi_block type of data transfer 0 = single block 1 = multiple block rw 0x0 4 tm_dat_dir direction of data transfer: 0 = from host to card 1 = from card to host rw 0x0 3:2 tm_auto_cmd_en select the command to be send after completion of a data transfer: 00 = no command 01 = command cmd12 10 = command cmd23 11 = reserved rw 0x0 1 tm_blkcnt_en enable the block counter for multiple block transfers: 0 = disabled 1 = enabled rw 0x0 0 reserved - write as 0, read as don't care resp0 register synopsis this register contains the status bits of the sd card s response. in case of commands cmd2 and cmd10 it contains cid[31:0] and in case of co mmand cmd9 it contains csd[31:0]. note: this register is only valid once the last comman d has completed and no new command was issued. bit(s) field name description type reset 31:0 response bits 31:0 of the card s response rw 0x0 resp1 register synopsis in case of commands cmd2 and cmd10 this register cont ains cid[63:32] and in case of command cmd9 it contains csd[63:32]. note: this register is only valid once the last comman d has completed and no new command was issued.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 71 ? 2012 broadcom corporation. all rights reserved bit(s) field name description type reset 31:0 response bits 63:32 of the card s response rw 0x0 resp2 register synopsis in case of commands cmd2 and cmd10 this register cont ains cid[95:64] and in case of command cmd9 it contains csd[95:64]. note: this register is only valid once the last comman d has completed and no new command was issued. bit(s) field name description type reset 31:0 response bits 95:64 of the card s response rw 0x0 resp3 register synopsis in case of commands cmd2 and cmd10 this register cont ains cid[127:96] and in case of command cmd9 it contains csd[127:96]. note: this register is only valid once the last comman d has completed and no new command was issued. bit(s) field name des cription type reset 31:0 response bits 127:96 of the card s response rw 0x0 data register synopsis this register is used to transfer data to/from the card. bit 1 of the interrupt register can be used to check i f data is available. for paced dma transfers the high active signal dma_req can be used. bit(s) field name description type reset 31:0 data data to/from the card rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 72 ? 2012 broadcom corporation. all rights reserved status register synopsis this register contains information intended for debu gging. its values change automatically according to the hardware. as it involves resynchronisation between different clock domains it changes only after some late ncy and it is easy sample the values too early. therefore it is not recommended to use this register for polling. instead use the interrupt register which implements a handshake mechan ism which makes it impossible to miss a change when polling. bit(s) field name description type reset 31:29 reserved - write as 0, read as don't care 28:25 dat_level1 value of data lines dat7 to dat4 rw 0xf 24 cmd_level value of command line cmd rw 0x1 23:20 dat_level0 value of data lines dat3 to dat0 rw 0xf 19:10 reserved - write as 0, read as don't care 9 read_transfer new data can be read from emmc: 0 = no 1 = yes rw 0x0 8 write_transfer new data can be written to emmc: 0 = no 1 = yes rw 0x0 7:3 reserved - write as 0, read as don't care 2 dat_active at least one data line is active: 0 = no 1 = yes rw 0x0 1 dat_inhibit data lines still used by previous data transfer: 0 = no 1 = yes rw 0x0 0 cmd_inhibit command line still used by previous command: 0 = no 1 = yes rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 73 ? 2012 broadcom corporation. all rights reserved control0 register synopsis this register is used to configure the emmc module. for the exact details please refer to the arasan do cumentation sd3.0_host_ahb_emmc4.4_usersguide_ver5.9_jan11_10.p df. bits marked as reserved in this document but not by the arasan docum entation refer to functionality which has been disabled due to the changes listed in the previous chapter. bit(s) field name description type reset 31:23 reserved - write as 0, read as don't care 22 alt_boot_en enable alternate boot mode access: 0 = disabled 1 = enabled rw 0x0 21 boot_en boot mode access: 0 = stop boot mode access 1 = start boot mode access rw 0x0 20 spi_mode spi mode enable: 0 = normal mode 1 = spi mode rw 0x0 19 gap_ien enable sdio interrupt at block gap (only valid if the hctl_dwidth bit is set): 0 = disabled 1 = enabled rw 0x0 18 readwait_en use dat2 read-wait protocol for sdio cards supporting this: 0 = disabled 1 = enabled rw 0x0 17 gap_restart restart a transaction which was stopped using the gap_stop bit: 0 = ignore 1 = restart rw 0x0 16 gap_stop stop the current transaction at the next block gap: 0 = ignore 1 = stop rw 0x0 15:6 reserved - write as 0, read as don't care 5 hctl_8bit use 8 data lines: 0 = disabled 1 = enabled rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 74 ? 2012 broadcom corporation. all rights reserved 4:3 reserved - write as 0, read as don't care 2 hctl_hs_en select high speed mode (i.e. dat and cmd lines change on the rising clk edge): 0 = disabled 1 = enabled rw 0x0 1 hctl_dwidth use 4 data lines: 0 = disabled 1 = enabled rw 0x0 0 reserved - write as 0, read as don't care control1 register synopsis this register is used to configure the emmc module. for the exact details please refer to the arasan do cumentation sd3.0_host_ahb_emmc4.4_usersguide_ver5.9_jan11_10.p df. bits marked as reserved in this document but not by the arasan docum entation refer to functionality which has been disabled due to the changes listed in the previous chapter. clk_stable seems contrary to its name only to indicat e that there was a rising edge on the clk_emmc input but not that the frequency of th is clock is actually stable. bit(s) field name description type reset 31:27 reserved - write as 0, read as don't care 26 srst_data reset the data handling circuit: 0 = disabled 1 = enabled rw 0x0 25 srst_cmd reset the command handling circuit: 0 = disabled 1 = enabled rw 0x0 24 srst_hc reset the complete host circuit: 0 = disabled 1 = enabled rw 0x0 23:20 reserved - write as 0, read as don't care 19:16 data_tounit data timeout unit exponent: 1111 = disabled x = tmclk * 2^(x+13) rw 0x0 15:8 clk_freq8 sd clock base divider lsbs rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 75 ? 2012 broadcom corporation. all rights reserved 7:6 clk_freq_ms2 sd clock base divider msbs rw 0x0 5 clk_gensel mode of clock generation: 0 = divided 1 = programmable rw 0x0 4:3 reserved - write as 0, read as don't care 2 clk_en sd clock enable: 0 = disabled 1 = enabled rw 0x0 1 clk_stable sd clock stable: 0 = no 1 = yes ro 0x0 0 clk_intlen clock enable for internal emmc clocks for power saving: 0 = disabled 1 = enabled rw 0x0 interrupt register synopsis this register holds the interrupt flags. each flag ca n be disabled using the according bit in the irpt_mask register. for the exact details please refer to the arasan do cumentation sd3.0_host_ahb_emmc4.4_usersguide_ver5.9_jan11_10.p df. bits marked as reserved in this document but not by the arasan docum entation refer to functionality which has been disabled due to the changes listed in the previous chapter. err is a generic flag and is set if any of the enabl ed error flags is set. bit(s) field name description type reset 31:25 reserved - write as 0, read as don't care 24 acmd_err auto command error: 0 = no error 1 = error rw 0x0 23 reserved - write as 0, read as don't care 22 dend_err end bit on data line not 1: 0 = no error 1 = error rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 76 ? 2012 broadcom corporation. all rights reserved 21 dcrc_err data crc error: 0 = no error 1 = error rw 0x0 20 dto_err timeout on data line: 0 = no error 1 = error rw 0x0 19 cbad_err incorrect command index in response: 0 = no error 1 = error rw 0x0 18 cend_err end bit on command line not 1: 0 = no error 1 = error rw 0x0 17 ccrc_err command crc error: 0 = no error 1 = error rw 0x0 16 cto_err timeout on command line: 0 = no error 1 = error rw 0x0 15 err an error has occured: 0 = no error 1 = error ro 0x0 14 endboot boot operation has terminated: 0 = no 1 = yes rw 0x0 13 bootack boot acknowledge has been received: 0 = no 1 = yes rw 0x0 12 retune clock retune request was made: 0 = no 1 = yes ro 0x0 11:9 reserved - write as 0, read as don't care 8 card card made interrupt request: 0 = no 1 = yes ro 0x0 7:6 reserved - write as 0, read as don't care
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 77 ? 2012 broadcom corporation. all rights reserved 5 read_rdy data register contains data to be read: 0 = no 1 = yes rw 0x0 4 write_rdy data can be written to data register: 0 = no 1 = yes rw 0x0 3 reserved - write as 0, read as don't care 2 block_gap data transfer has stopped at block gap: 0 = no 1 = yes rw 0x0 1 data_done data transfer has finished: 0 = no 1 = yes rw 0x0 0 cmd_done command has finished: 0 = no 1 = yes rw 0x0 irpt_mask register synopsis this register is used to mask the interrupt flags in the interrupt register. for the exact details please refer to the arasan do cumentation sd3.0_host_ahb_emmc4.4_usersguide_ver5.9_jan11_10.p df. bits marked as reserved in this document but not by the arasan docum entation refer to functionality which has been disabled due to the changes listed in the previous chapter. bit(s) field name description type reset 31:25 reserved - write as 0, read as don't care 24 acmd_err set flag if auto command error: 0 = no 1 = yes rw 0x0 23 reserved - write as 0, read as don't care 22 dend_err set flag if end bit on data line not 1: 0 = no 1 = yes rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 78 ? 2012 broadcom corporation. all rights reserved 21 dcrc_err set flag if data crc error: 0 = no 1 = yes rw 0x0 20 dto_err set flag if timeout on data line: 0 = no 1 = yes rw 0x0 19 cbad_err set flag if incorrect command index in response: 0 = no 1 = yes rw 0x0 18 cend_err set flag if end bit on command line not 1: 0 = no 1 = yes rw 0x0 17 ccrc_err set flag if command crc error: 0 = no 1 = yes rw 0x0 16 cto_err set flag if timeout on command line: 0 = no 1 = yes rw 0x0 15 reserved - write as 0, read as don't care 14 endboot set flag if boot operation has terminated: 0 = no 1 = yes rw 0x0 13 bootack set flag if boot acknowledge has been received: 0 = no 1 = yes rw 0x0 12 retune set flag if clock retune request was made: 0 = no 1 = yes rw 0x0 11:9 reserved - write as 0, read as don't care 8 card set flag if card made interrupt request: 0 = no 1 = yes rw 0x0 7:6 reserved - write as 0, read as don't care 5 read_rdy set flag if data register contains data to be read: 0 = no 1 = yes rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 79 ? 2012 broadcom corporation. all rights reserved 4 write_rdy set flag if data can be written to data register: 0 = no 1 = yes rw 0x0 3 reserved - write as 0, read as don't care 2 block_gap set flag if data transfer has stopped at block gap: 0 = no 1 = yes rw 0x0 1 data_done set flag if data transfer has finished: 0 = no 1 = yes rw 0x0 0 cmd_done set flag if command has finished: 0 = no 1 = yes rw 0x0 irpt_en register synopsis this register is used to enable the different inter rupts in the interrupt register to generate an interrupt on the int_to_arm output. for the exact details please refer to the arasan do cumentation sd3.0_host_ahb_emmc4.4_usersguide_ver5.9_jan11_10.p df. bits marked as reserved in this document but not by the arasan docum entation refer to functionality which has been disabled due to the changes listed in the previous chapter. bit(s) field name description type reset 31:25 reserved - write as 0, read as don't care 24 acmd_err create interrupt if auto command error: 0 = no 1 = yes rw 0x0 23 reserved - write as 0, read as don't care 22 dend_err create interrupt if end bit on data line not 1: 0 = no 1 = yes rw 0x0 21 dcrc_err create interrupt if data crc error: 0 = no 1 = yes rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 80 ? 2012 broadcom corporation. all rights reserved 20 dto_err create interrupt if timeout on data line: 0 = no 1 = yes rw 0x0 19 cbad_err create interrupt if incorrect command index in response: 0 = no 1 = yes rw 0x0 18 cend_err create interrupt if end bit on command line not 1: 0 = no 1 = yes rw 0x0 17 ccrc_err create interrupt if command crc error: 0 = no 1 = yes rw 0x0 16 cto_err create interrupt if timeout on command line: 0 = no 1 = yes rw 0x0 15 reserved - write as 0, read as don't care 14 endboot create interrupt if boot operation has terminated: 0 = no 1 = yes rw 0x0 13 bootack create interrupt if boot acknowledge has been received: 0 = no 1 = yes rw 0x0 12 retune create interrupt if clock retune request was made: 0 = no 1 = yes rw 0x0 11:9 reserved - write as 0, read as don't care 8 card create interrupt if card made interrupt request: 0 = no 1 = yes rw 0x0 7:6 reserved - write as 0, read as don't care 5 read_rdy create interrupt if data register contains data to be read: 0 = no 1 = yes rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 81 ? 2012 broadcom corporation. all rights reserved 4 write_rdy create interrupt if data can be written to data register: 0 = no 1 = yes rw 0x0 3 reserved - write as 0, read as don't care 2 block_gap create interrupt if data transfer has stopped at block gap: 0 = no 1 = yes rw 0x0 1 data_done create interrupt if data transfer has finished: 0 = no 1 = yes rw 0x0 0 cmd_done create interrupt if command has finished: 0 = no 1 = yes rw 0x0 control2 register synopsis this register is used to enable the different inter rupts in the interrupt register to generate an interrupt on the int_to_arm output. for the exact details please refer to the arasan do cumentation sd3.0_host_ahb_emmc4.4_usersguide_ver5.9_jan11_10.p df. bits marked as reserved in this document but not by the arasan docum entation refer to functionality which has been disabled due to the changes listed in the previous chapter. bit (s) field name description type reset 31:24 reserved - write as 0, read as don't care 23 tuned tuned clock is used for sampling data: 0 = no 1 = yes rw 0x0 22 tuneon start tuning the sd clock: 0 = not tuned or tuning complete 1 = tuning rw 0x0 21:19 reserved - write as 0, read as don't care
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 82 ? 2012 broadcom corporation. all rights reserved 18:16 uhsmode select the speed mode of the sd card: 000 = sdr12 001 = sdr25 010 = sdr50 011 = sdr104 100 = ddr50 other = reserved rw 0x0 15:8 reserved - write as 0, read as don't care 7 notc12_err error occurred during auto command cmd12 execution: 0 = no error 1 = error ro 0x0 6:5 reserved - write as 0, read as don't care 4 acbad_err command index error occurred during auto command execution: 0 = no error 1 = error ro 0x0 3 acend_err end bit is not 1 during auto command execution: 0 = no error 1 = error ro 0x0 2 accrc_err command crc error occurred during auto command execution: 0 = no error 1 = error ro 0x0 1 acto_err timeout occurred during auto command execution: 0 = no error 1 = error ro 0x0 0 acnox_err auto command not executed due to an error: 0 = no 1 = yes ro 0x0 force_irpt register synopsis this register is used to fake the different interrup t events for debugging. for the exact details please refer to the arasan do cumentation sd3.0_host_ahb_emmc4.4_usersguide_ver5.9_jan11_10.p df. bits marked as reserved in this document but not by the arasan docum entation refer to functionality which has been disabled due to the changes listed in the previous chapter.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 83 ? 2012 broadcom corporation. all rights reserved bit(s) field name descri ption type reset 31:25 reserved - write as 0, read as don't care 24 acmd_err create auto command error: 0 = no 1 = yes rw 0x0 23 reserved - write as 0, read as don't care 22 dend_err create end bit on data line not 1: 0 = no 1 = yes rw 0x0 21 dcrc_err create data crc error: 0 = no 1 = yes rw 0x0 20 dto_err create timeout on data line: 0 = no 1 = yes rw 0x0 19 cbad_err create incorrect command index in response: 0 = no 1 = yes rw 0x0 18 cend_err create end bit on command line not 1: 0 = no 1 = yes rw 0x0 17 ccrc_err create command crc error: 0 = no 1 = yes rw 0x0 16 cto_err create timeout on command line: 0 = no 1 = yes rw 0x0 15 reserved - write as 0, read as don't care 14 endboot create boot operation has terminated: 0 = no 1 = yes rw 0x0 13 bootack create boot acknowledge has been received: 0 = no 1 = yes rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 84 ? 2012 broadcom corporation. all rights reserved 12 retune create clock retune request was made: 0 = no 1 = yes rw 0x0 11:9 reserved - write as 0, read as don't care 8 card create card made interrupt request: 0 = no 1 = yes rw 0x0 7:6 reserved - write as 0, read as don't care 5 read_rdy create data register contains data to be read: 0 = no 1 = yes rw 0x0 4 write_rdy create data can be written to data register: 0 = no 1 = yes rw 0x0 3 reserved - write as 0, read as don't care 2 block_gap create interrupt if data transfer has stopped at block gap: 0 = no 1 = yes rw 0x0 1 data_done create data transfer has finished: 0 = no 1 = yes rw 0x0 0 cmd_done create command has finished: 0 = no 1 = yes rw 0x0 boot_timeout register synopsis this register configures after how many card clock cycles a timeout for e.mmc cards in boot mode is flagged bit(s) field name description type reset 31:0 timeout number of card clock cycles after which a timeout during boot mode is flagged rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 85 ? 2012 broadcom corporation. all rights reserved dbg_sel register synopsis this register selects which submodules are accessed by t he debug bus. for the exact details please refer to the arasan do cumentation sd3.0_host_ahb_emmc4.4_usersguide_ver5.9_jan11_10.p df. bits marked as reserved in this document but not by the arasan docum entation refer to functionality which has been disabled due to the changes listed in the previous chapter. bit(s) field name descri ption type reset 31:1 reserved - write as 0, read as don't care 0 select submodules accessed by debug bus: 0 = receiver and fifo_ctrl 1 = others rw 0x0 exrdfifo_cfg register synopsis this register allows fine tuning the dma_req genera tion for paced dma transfers when reading from the card. if the extension data fifo con tains less than rd_thrsh 32 bits words dma_req becomes inactive until the card has filled the extension data fifo above threshold. this compensates the dma latency. when writing data to the card the extension data fif o feeds into the emmc module s fifo and no fine tuning is required therefore the r d_thrsh value is in this case ignored. bit(s) field name description type reset 31:3 reserved - write as 0, read as don't care 2:0 rd_thrsh read threshold in 32 bits words rw 0x0 exrdfifo_en register synopsis this register enables the extension data register. i t should be enabled for paced dma transfers and be bypassed for burst dma transfers. bit(s) field name description type reset 31:1 reserved - write as 0, read as don't care
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 86 ? 2012 broadcom corporation. all rights reserved 0 enable enable the extension fifo: 0 = bypass 1 = enabled rw 0x0 tune_step register synopsis this register is used to delay the card clock when samp ling the returning data and command response from the card. delay determines by how much the sampling clock is dela yed per step. bit(s) field name description type reset 31:3 reserved - write as 0, read as don't care 2:0 delay sampling clock delay per step: 000 = 200ps typically 001 = 400ps typically 010 = 400ps typically 011 = 600ps typically 100 = 700ps typically 101 = 900ps typically 110 = 900ps typically 111 = 1100ps typically rw 0x0 tune_steps_std register synopsis this register is used to delay the card clock when samp ling the returning data and command response from the card. it determines by how m any steps the sampling clock is delayed in sdr mode. bit(s) field name description type reset 31:6 reserved - write as 0, read as don't care 5:0 steps number of steps (0 to 40) rw 0x0 tune_steps_ddr register
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 87 ? 2012 broadcom corporation. all rights reserved synopsis this register is used to delay the card clock when samp ling the returning data and command response from the card. it determines by how m any steps the sampling clock is delayed in ddr mode. bit(s) field name description type reset 31:6 reserved - write as 0, read as don't care 5:0 steps number of steps (0 to 40) rw 0x0 spi_int_spt register synopsis this register controls whether assertion of interrupt s in spi mode is possible independent of the card select line. for the exact details please refer to the arasan do cumentation sd3.0_host_ahb_emmc4.4_usersguide_ver5.9_jan11_10.p df. bit marked as reserved in this document but not by the arasan docum entation refer to functionality which has been disabled due to the changes listed in the previous chapter. bit(s) field name description type reset 31:8 reserved - write as 0, read as don't care 7:0 select interrupt independent of card select line: 0 = no 1 = yes rw 0x0 slotisr_ver register synopsis this register contains the version information and s lot interrupt status. for the exact details please refer to the arasan do cumentation sd3.0_host_ahb_emmc4.4_usersguide_ver5.9_jan11_10.p df. bit marked as reserved in this document but not by the arasan docum entation refer to functionality which has been disabled due to the changes listed in the previous chapter. bit(s) field name description type reset 31:24 vendor vendor version number rw 0x0 23:16 sdversion host controller specification version rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 88 ? 2012 broadcom corporation. all rights reserved 15:8 reserved - write as 0, read as don't care 7:0 slot_status logical or of interrupt and wakeup signal for each slot rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 89 ? 2012 broadcom corporation. all rights reserved 6 general purpose i/o (gpio) there are 54 general-purpose i/o (gpio) lines split into t wo banks. all gpio pins have at least two alternative functions within bcm. the alterna te functions are usually peripheral io and a single peripheral may appear in each bank to allow flexibility on the choice of io voltage. details of alternative functions are given i n section 6.2. alternative function assignments. the block diagram for an individual gpio pin is given belo w : figure 6-1 gpio block diagram
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 90 ? 2012 broadcom corporation. all rights reserved the gpio peripheral has three dedicated interrupt lines. these lines are triggered by the setting of bits in the event detect status register. each bank has its? own interrupt line with the third line shared between all bits. the alternate function table also has the pull state (pull-up/pull-down) which is applied after a power down. 6.1 register view the gpio has 41 registers. all accesses are assumed to be 32-bit. address field name description size read/ write 0x 7e20 0000 gpfsel0 gpio function select 0 32 r/w 0x 7e20 0000 gpfsel0 gpio function select 0 32 r/w 0x 7e20 0004 gpfsel1 gpio function select 1 32 r/w 0x 7e20 0008 gpfsel2 gpio function select 2 32 r/w 0x 7e20 000c gpfsel3 gpio function select 3 32 r/w 0x 7e20 0010 gpfsel4 gpio function select 4 32 r/w 0x 7e20 0014 gpfsel5 gpio function select 5 32 r/w 0x 7e20 0018 - reserved - - 0x 7e20 001c gpset0 gpio pin output set 0 32 w 0x 7e20 0020 gpset1 gpio pin output set 1 32 w 0x 7e20 0024 - reserved - - 0x 7e20 0028 gpclr0 gpio pin output clear 0 32 w 0x 7e20 002c gpclr1 gpio pin output clear 1 32 w 0x 7e20 0030 - reserved - - 0x 7e20 0034 gplev0 gpio pin level 0 32 r 0x 7e20 0038 gplev1 gpio pin level 1 32 r 0x 7e20 003c - reserved - - 0x 7e20 0040 gpeds0 gpio pin event detect status 0 32 r/w 0x 7e20 0044 gpeds1 gpio pin event detect status 1 32 r/w 0x 7e20 0048 - reserved - - 0x 7e20 004c gpren0 gpio pin rising edge detect enable 0 32 r/w 0x 7e20 0050 gpren1 gpio pin rising edge detect enable 1 32 r/w 0x 7e20 0054 - reserved - - 0x 7e20 0058 gpfen0 gpio pin falling edge detect enable 0 32 r/w 0x 7e20 005c gpfen1 gpio pin falling edge detect enable 1 32 r/w
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 91 ? 2012 broadcom corporation. all rights reserved address field name description size read/ write 0x 7e20 0060 - reserved - - 0x 7e20 0064 gphen0 gpio pin high detect enable 0 32 r/w 0x 7e20 0068 gphen1 gpio pin high detect enable 1 32 r/w 0x 7e20 006c - reserved - - 0x 7e20 0070 gplen0 gpio pin low detect enable 0 32 r/w 0x 7e20 0074 gplen1 gpio pin low detect enable 1 32 r/w 0x 7e20 0078 - reserved - - 0x 7e20 007c gparen0 gpio pin async. rising edge detect 0 32 r/w 0x 7e20 0080 gparen1 gpio pin async. rising edge detect 1 32 r/w 0x 7e20 0084 - reserved - - 0x 7e20 0088 gpafen0 gpio pin async. falling edge detect 0 32 r/w 0x 7e20 008c gpafen1 gpio pin async. falling edge detect 1 32 r/w 0x 7e20 0090 - reserved - - 0x 7e20 0094 gppud gpio pin pull-up/down enable 32 r/w 0x 7e20 0098 gppudclk0 gpio pin pull-up/down enable clock 0 32 r/w 0x 7e20 009c gppudclk1 gpio pin pull-up/down enable clock 1 32 r/w 0x 7e20 00a0 - reserved - - 0x 7e20 00b0 - test 4 r/w table 6-1 gpio register assignment gpio function select registers (gpfseln) s ynopsis the function select registers are used to define th e operation of the general - purpose i/o pins. each of the 54 gpio pins has at least two al ternative functions as defined in section 16.2. the fsel{n} field determines the functionalit y of the nth gpio pin. all unused alternative function lines are tied to ground and w ill output a 0 if selected. all pins reset to normal gpio input operation. bit(s) field name description type reset 31-30 --- reserved r 0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 92 ? 2012 broadcom corporation. all rights reserved 29-27 fsel9 fsel9 - function select 9 000 = gpio pin 9 is an input 001 = gpio pin 9 is an output 100 = gpio pin 9 takes alternate function 0 101 = gpio pin 9 takes alternate function 1 110 = gpio pin 9 takes alternate function 2 111 = gpio pin 9 takes alternate function 3 011 = gpio pin 9 takes alternate function 4 010 = gpio pin 9 takes alternate function 5 r/w 0 26-24 fsel8 fsel8 - function select 8 r/w 0 23-21 fsel7 fsel7 - function select 7 r/w 0 20-18 fsel6 fsel6 - function select 6 r/w 0 17-15 fsel5 fsel5 - function select 5 r/w 0 14-12 fsel4 fsel4 - function select 4 r/w 0 11-9 fsel3 fsel3 - function select 3 r/w 0 8-6 fsel2 fsel2 - function select 2 r/w 0 5-3 fsel1 fsel1 - function select 1 r/w 0 2-0 fsel0 fsel0 - function select 0 r/w 0 table 6-2 C gpio alternate function select register 0 bit(s) field name description type reset 31-30 --- reserved r 0 29-27 fsel19 fsel19 - function select 19 000 = gpio pin 19 is an input 001 = gpio pin 19 is an output 100 = gpio pin 19 takes alternate function 0 101 = gpio pin 19 takes alternate function 1 110 = gpio pin 19 takes alternate function 2 111 = gpio pin 19 takes alternate function 3 011 = gpio pin 19 takes alternate function 4 010 = gpio pin 19 takes alternate function 5 r/w 0 26-24 fsel18 fsel18 - function select 18 r/w 0 23-21 fsel17 fsel17 - function select 17 r/w 0 20-18 fsel16 fsel16 - function select 16 r/w 0 17-15 fsel15 fsel15 - function select 15 r/w 0 14-12 fsel14 fsel14 - function select 14 r/w 0 11-9 fsel13 fsel13 - function select 13 r/w 0 8-6 fsel12 fsel12 - function select 12 r/w 0 5-3 fsel11 fsel11 - function select 11 r/w 0 2-0 fsel10 fsel10 - function select 10 r/w 0 table 6-3 C gpio alternate function select register 1
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 93 ? 2012 broadcom corporation. all rights reserved bit(s) field name description type reset 31-30 --- reserved r 0 29-27 fsel29 fsel29 - function select 29 000 = gpio pin 29 is an input 001 = gpio pin 29 is an output 100 = gpio pin 29 takes alternate function 0 101 = gpio pin 29 takes alternate function 1 110 = gpio pin 29 takes alternate function 2 111 = gpio pin 29 takes alternate function 3 011 = gpio pin 29 takes alternate function 4 010 = gpio pin 29 takes alternate function 5 r/w 0 26-24 fsel28 fsel28 - function select 28 r/w 0 23-21 fsel27 fsel27 - function select 27 r/w 0 20-18 fsel26 fsel26 - function select 26 r/w 0 17-15 fsel25 fsel25 - function select 25 r/w 0 14-12 fsel24 fsel24 - function select 24 r/w 0 11-9 fsel23 fsel23 - function select 23 r/w 0 8-6 fsel22 fsel22 - function select 22 r/w 0 5-3 fsel21 fsel21 - function select 21 r/w 0 2-0 fsel20 fsel20 - function select 20 r/w 0 table 6-4 C gpio alternate function select register 2 bit(s) field name description type reset 31-30 --- reserved r 0 29-27 fsel39 fsel39 - function select 39 000 = gpio pin 39 is an input 001 = gpio pin 39 is an output 100 = gpio pin 39 takes alternate function 0 101 = gpio pin 39 takes alternate function 1 110 = gpio pin 39 takes alternate function 2 111 = gpio pin 39 takes alternate function 3 011 = gpio pin 39 takes alternate function 4 010 = gpio pin 39 takes alternate function 5 r/w 0 26-24 fsel38 fsel38 - function select 38 r/w 0 23-21 fsel37 fsel37 - function select 37 r/w 0 20-18 fsel36 fsel36 - function select 36 r/w 0 17-15 fsel35 fsel35 - function select 35 r/w 0 14-12 fsel34 fsel34 - function select 34 r/w 0 11-9 fsel33 fsel33 - function select 33 r/w 0 8-6 fsel32 fsel32 - function select 32 r/w 0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 94 ? 2012 broadcom corporation. all rights reserved 5-3 fsel31 fsel31 - function select 31 r/w 0 2-0 fsel30 fsel30 - function select 30 r/w 0 table 6-5 C gpio alternate function select register 3 bit(s) field name description type reset 31-30 --- reserved r 0 29-27 fsel49 fsel49 - function select 49 000 = gpio pin 49 is an input 001 = gpio pin 49 is an output 100 = gpio pin 49 takes alternate function 0 101 = gpio pin 49 takes alternate function 1 110 = gpio pin 49 takes alternate function 2 111 = gpio pin 49 takes alternate function 3 011 = gpio pin 49 takes alternate function 4 010 = gpio pin 49 takes alternate function 5 r/w 0 26-24 fsel48 fsel48 - function select 48 r/w 0 23-21 fsel47 fsel47 - function select 47 r/w 0 20-18 fsel46 fsel46 - function select 46 r/w 0 17-15 fsel45 fsel45 - function select 45 r/w 0 14-12 fsel44 fsel44 - function select 44 r/w 0 11-9 fsel43 fsel43 - function select 43 r/w 0 8-6 fsel42 fsel42 - function select 42 r/w 0 5-3 fsel41 fsel41 - function select 41 r/w 0 2-0 fsel40 fsel40 - function select 40 r/w 0 table 6-6 C gpio alternate function select register 4 bit(s) field name description type reset 31-12 --- reserved r 0 11-9 fsel53 fsel53 - function select 53 000 = gpio pin 53 is an input 001 = gpio pin 53 is an output 100 = gpio pin 53 takes alternate function 0 101 = gpio pin 53 takes alternate function 1 110 = gpio pin 53 takes alternate function 2 111 = gpio pin 53 takes alternate function 3 011 = gpio pin 53 takes alternate function 4 010 = gpio pin 53 takes alternate function 5 r/w 0 8-6 fsel52 fsel52 - function select 52 r/w 0 5-3 fsel51 fsel51 - function select 51 r/w 0 2-0 fsel50 fsel50 - function select 50 r/w 0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 95 ? 2012 broadcom corporation. all rights reserved table 6-7 C gpio alternate function select register 5 gpio pin output set registers (gpsetn) s ynopsis the output set registers are used to set a gpio pin . the set{n} field defines the respective gpio pin to set, writing a ?0? to the field has no effect. if the gpio pin is being used as in input (by default) then the value in the set{n} field is ignored. however, if the pin is subsequently defined as an ou tput then the bit will be set according to the last set/clear operation. separating the set and clear functions removes the need for read-modify-write operations bit(s) field name description type reset 31-0 setn (n=0..31) 0 = no effect 1 = set gpio pin n r/w 0 table 6-8 C gpio output set register 0 bit(s) field name description type reset 31-22 - reserved r 0 21-0 setn (n=32..53) 0 = no effect 1 = set gpio pin n. r/w 0 table 6-9 C gpio output set register 1 gpio pin output clear registers (gpclrn) s ynopsis the output clear registers) are used to clear a gpio pin. the clr{n} field defines the respective gpio pin to clear, writing a ?0? to the field has no effect. if the gpio pin is being used as in input (by default) then the value in the clr{n} field is ignored. however, if the pin is subsequently defined as an output then the bit will be set according to the last set/clear operation. sepa rating the set and clear functions removes the need for read-modify-write op erations. bit(s) field name description type reset 31-0 clrn (n=0..31) 0 = no effect 1 = clear gpio pin n r/w 0 table 6-10 C gpio output clear register 0 bit(s) field name description type reset 31-22 - reserved r 0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 96 ? 2012 broadcom corporation. all rights reserved 21-0 clrn (n=32..53) 0 = no effect 1 = set gpio pin n r/w 0 table 6-11 C gpio output clear register 1 gpio pin level registers (gplevn) s ynopsis the pin level registers return the actual value of t he pin. the lev{n} field gives the value of the respective gpio pin. bit(s) field name description type reset 31-0 levn (n=0..31) 0 = gpio pin n is low 0 = gpio pin n is high r/w 0 table 6-12 C gpio level register 0 bit(s) field name description type reset 31-22 - reserved r 0 21-0 levn (n=32..53) 0 = gpio pin n is low 0 = gpio pin n is high r/w 0 table 6-13 C gpio level register 1 gpio event detect status registers (gpedsn) s ynopsis the event detect status registers are used to record level and edge events on the gpio pins. the relevant bit in the event detect stat us registers is set whenever: 1) an edge is detected that matches the type of edge prog rammed in the rising/falling edge detect enable registers, or 2) a level is detect ed that matches the type of level programmed in the high/low level detect enable regis ters. the bit is cleared by writing a ?1? to the relevant bit. the interrupt controller can be programmed to interru pt the processor when any of the status bits are set. the gpio peripheral has th ree dedicated interrupt lines. each gpio bank can generate an independent interrupt. the third line generates a single interrupt whenever any bit is set. bit(s) field name description type reset 31-0 edsn (n=0..31) 0 = event not detected on gpio pin n 1 = event detected on gpio pin n r/w 0 table 6-14 C gpio event detect status register 0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 97 ? 2012 broadcom corporation. all rights reserved bit(s) field name description type reset 31-22 - reserved r 0 21-0 edsn (n=32..53) 0 = event not detected on gpio pin n 1 = event detected on gpio pin n r/w 0 table 6-15 C gpio event detect status register 1 gpio rising edge detect enable registers (gprenn) s ynopsis the rising edge detect enable registers define the p ins for which a rising edge transition sets a bit in the event detect status re gisters ( gpedsn ). when the relevant bits are set in both the gprenn and gpfenn registers, any transition (1 to 0 and 0 to 1) will set a bit in the gpedsn registers. the gprenn registers use synchronous edge detection. this means the input signa l is sampled using the system clock and then it is looking for a ?011? pattern on the sampled signal. this has the effect of suppressing glitches. bit(s) field name description type reset 31-0 renn (n=0..31) 0 = rising edge detect disabled on gpio pin n. 1 = rising edge on gpio pin n sets corresponding bit in edsn. r/w 0 table 6-16 C gpio rising edge detect status registe r 0 bit(s) field name description type reset 31-22 - reserved r 0 21-0 renn (n=32..53) 0 = rising edge detect disabled on gpio pin n. 1 = rising edge on gpio pin n sets corresponding bit in edsn. r/w 0 table 6-17 C gpio rising edge detect status registe r 1
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 98 ? 2012 broadcom corporation. all rights reserved gpio falling edge detect enable registers (gprenn) s ynopsis the falling edge detect enable registers define the pins for which a falling edge transition sets a bit in the event detect status re gisters ( gpedsn ). when the relevant bits are set in both the gprenn and gpfenn registers, any transition (1 to 0 and 0 to 1) will set a bit in the gpedsn registers. the gpfenn registers use synchronous edge detection. this means the input signal is sampl ed using the system clock and then it is looking for a ?100? pattern on the sampled signal. this has the effect of suppressing glitches. bit(s) field name description type reset 31-0 fenn (n=0..31) 0 = falling edge detect disabled on gpio pin n. 1 = falling edge on gpio pin n sets corresponding bit in edsn. r/w 0 table 6-18 C gpio falling edge detect status regist er 0 bit(s) field name description type reset 31-22 - reserved r 0 21-0 fenn (n=32..53) 0 = falling edge detect disabled on gpio pin n. 1 = falling edge on gpio pin n sets corresponding bit in edsn. r/w 0 table 6-19 C gpio falling edge detect status regist er 1 gpio high detect enable registers (gphenn) s ynopsis the high level detect enable registers define the p ins for which a high level sets a bit in the event detect status register ( gpedsn ). if the pin is still high when an attempt is made to clear the status bit in gpedsn then the status bit will remain set. bit(s) field name description type reset 31-0 henn (n=0..31) 0 = high detect disabled on gpio pin n 1 = high on gpio pin n sets corresponding bit in gpeds r/w 0 table 6-20 C gpio high detect status register 0 bit(s) field name description type reset 31-22 - reserved r 0 21-0 henn (n=32..53) 0 = high detect disabled on gpio pin n 1 = high on gpio pin n sets corresponding bit in gpeds r/w 0 table 6-21 C gpio high detect status register 1
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 99 ? 2012 broadcom corporation. all rights reserved gpio low detect enable registers (gplenn) s ynopsis the low level detect enable registers define the pi ns for which a low level sets a bit in the event detect status register ( gpedsn ). if the pin is still low when an attempt is made to clear the status bit in gpedsn then the status bit will remain set. bit(s) field name description type reset 31-0 lenn (n=0..31) 0 = low detect disabled on gpio pin n 1 = low on gpio pin n sets corresponding bit in gpeds r/w 0 table 6-22 C gpio low detect status register 0 bit(s) field name description type reset 31-22 - reserved r 0 21-0 lenn (n=32..53) 0 = low detect disabled on gpio pin n 1 = low on gpio pin n sets corresponding bit in gpeds r/w 0 table 6-23 C gpio low detect status register 1 gpio asynchronous rising edge detect enable registe rs (gparenn) s ynopsis the asynchronous rising edge detect enable registers d efine the pins for which a asynchronous rising edge transition sets a bit in the event detect status registers ( gpedsn ). asynchronous means the incoming signal is not sampled by the system clock. as such rising edges of very short duration can be detected. bit(s) field name description type reset 31-0 arenn (n=0..31) 0 = asynchronous rising edge detect disabled on gpio p in n. 1 = asynchronous rising edge on gpio pin n sets corresponding bit in edsn. r/w 0 table 6-24 C gpio asynchronous rising edge detect s tatus register 0 bit(s) field name description type reset 31-22 - reserved r 0 21-0 arenn (n=32..53) 0 = asynchronous rising edge detect disabled on gpio p in n. 1 = asynchronous rising edge on gpio pin n sets corresponding bit in edsn. r/w 0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 100 ? 2012 broadcom corporation. all rights reserved table 6-25 C gpio asynchronous rising edge detect s tatus register 1 gpio asynchronous falling edge detect enable regist ers (gpafenn) s ynopsis the asynchronous falling edge detect enable registers define the pins for which a asynchronous falling edge transition sets a bit in th e event detect status registers ( gpedsn ). asynchronous means the incoming signal is not sampl ed by the system clock. as such falling edges of very short duration can be detected. bit(s) field name description type reset 31-0 afenn (n=0..31) 0 = asynchronous falling edge detect disabled on gpio pin n. 1 = asynchronous falling edge on gpio pin n sets corresponding bit in edsn. r/w 0 table 6-26 C gpio asynchronous falling edge detect status register 0 bit(s) field name description type reset 31-22 - reserved r 0 21-0 afenn (n=32..53) 0 = asynchronous falling edge detect disabled on gpio pin n. 1 = asynchronous falling edge on gpio pin n sets corresponding bit in edsn. r/w 0 table 6-27 C gpio asynchronous falling edge detect status register 1 gpio pull-up/down register (gppud) s ynopsis the gpio pull-up/down register controls the actuation of the internal pull-up/down control line to all the gpio pins. this register mus t be used in conjunction with the 2 gppudclkn registers. note that it is not possible to read back the current pull-up/down settings and so it is the users? responsibility to ?remember? which pull-up/do wns are active. the reason for this is that gpio pull-ups are maintained even in power-dow n mode when the core is off, when all register contents is lost. the alternate function table also has the pull state which is applied after a power down. bit(s) field name description type reset
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 101 ? 2012 broadcom corporation. all rights reserved 31-2 --- unused r 0 1-0 pud pud - gpio pin pull-up/down 00 = off ? disable pull-up/down 01 = enable pull down control 10 = enable pull up control 11 = reserved *use in conjunction with gppudclk0/1/2 r/w 0 table 6-28 C gpio pull-up/down register (gppud) gpio pull-up/down clock registers (gppudclkn) s ynopsis the gpio pull-up/down clock registers control the actua tion of internal pull-downs on the respective gpio pins. these registers must be us ed in conjunction with the gppud register to effect gpio pull-up/down changes. the fol lowing sequence of events is required: 1. write to gppud to set the required control signal (i.e. pull-up or pull-down or neither to remove the current pull-up/down) 2. wait 150 cycles ? this provides the required set-u p time for the control signal 3. write to gppudclk0/1 to clock the control signal in to the gpio pads you wish to modify ? note only the pads which receive a clock will be modified, all others will retain their previous state. 4. wait 150 cycles ? this provides the required hold time for the control signal 5. write to gppud to remove the control signal 6. write to gppudclk0/1 to remove the clock bit(s) field name description type reset (31-0) pudclkn (n=0..31) 0 = no effect 1 = assert clock on line (n) *must be used in conjunction with gppud r/w 0 table 6-29 C gpio pull-up/down clock register 0 bit(s) field name description type reset 31-22 - reserved r 0 21-0 pudclkn (n=32..53) 0 = no effect 1 = assert clock on line (n) *must be used in conjunction with gppud r/w 0 table 6-30 C gpio pull-up/down clock register 1
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 102 ? 2012 broadcom corporation. all rights reserved 6.2 alternative function assignments every gpio pin can carry an alternate function. up to 6 alternate function are available but not every pin has that many alternate functions. the table below gives a quick over view. pull alt0 alt1 alt2 alt3 alt4 alt5 gpio0 high sda0 sa5 gpio1 high scl0 sa4 gpio2 high sda1 sa3 gpio3 high scl1 sa2 gpio4 high gpclk0 sa1 arm_tdi gpio5 high gpclk1 sa0 arm_tdo gpio6 high gpclk2 soe_n / se arm_rtck gpio7 high spi0_ce1_n swe_n / srw_n gpio8 high spi0_ce0_n sd0 gpio9 low spi0_miso sd1 gpio10 low spi0_mosi sd2 gpio11 low spi0_sclk sd3 gpio12 low pwm0 sd4 arm_tms gpio13 low pwm1 sd5 arm_tck gpio14 low txd0 sd6 txd1 gpio15 low rxd0 sd7 rxd1 gpio16 low sd8 cts0 spi1_ce2_n cts1 gpio17 low sd9 rts0 spi1_ce1_n rts1 gpio18 low pcm_clk sd10 bscsl sda / mosi spi1_ce0_n pwm0 gpio19 low pcm_fs sd11 bscsl scl / sclk spi1_miso pwm1 gpio20 low pcm_din sd12 bscsl / miso spi1_mosi gpclk0 gpio21 low pcm_dout sd13 bscsl / ce_n spi1_sclk gpclk1 gpio22 low sd14 sd1_clk arm_trst gpio23 low sd15 sd1_cmd arm_rtck gpio24 low sd16 sd1_dat0 arm_tdo gpio25 low sd17 sd1_dat1 arm_tck gpio26 low sd1_dat2 arm_tdi gpio27 low sd1_dat3 arm_tms gpio28 - sda0 sa5 pcm_clk gpio29 - scl0 sa4 pcm_fs gpio30 low sa3 pcm_din cts0 cts1 gpio31 low sa2 pcm_dout rts0 rts1 gpio32 low gpclk0 sa1 txd0 txd1 gpio33 low sa0 rxd0 rxd1 gpio34 high gpclk0 soe_n / se gpio35 high spi0_ce1_n swe_n / srw_n gpio36 high spi0_ce0_n sd0 txd0 gpio37 low spi0_miso sd1 rxd0 gpio38 low spi0_mosi sd2 rts0 gpio39 low spi0_sclk sd3 cts0 gpio40 low pwm0 sd4 spi2_miso txd1 pull alt0 alt1 alt2 alt3 alt4 alt5
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 103 ? 2012 broadcom corporation. all rights reserved gpio41 low pwm1 sd5 spi2_mosi rxd1 gpio42 low gpclk1 sd6 spi2_sclk rts1 gpio43 low gpclk2 sd7 spi2_ce0_n cts1 gpio44 - gpclk1 sda0 sda1 spi2_ce1_n gpio45 - pwm1 scl0 scl1 spi2_ce2_n gpio46 high gpio47 high gpio48 high gpio49 high gpio50 high gpio51 high gpio52 high gpio53 high table 6-31 gpio pins alternative function assignmen t entries which are white should not be used. these may have unexpected results as some of these have special functions used in test mode. e.g. they may drive the output with high frequency signals. special function legend: name function see section sda0 bsc 6 master 0 data line bsc scl0 bsc master 0 clock line bsc sda1 bsc master 1 data line bsc scl1 bsc master 1 clock line bsc gpclk0 general purpose clock 0 gpclk1 general purpose clock 1 gpclk2 general purpose clock 2 spi0_ce1_n spi0 chip select 1 spi spi0_ce0_n spi0 chip select 0 spi spi0_miso spi0 miso spi spi0_mosi spi0 mosi spi spi0_sclk spi0 serial clock spi pwmx pulse width modulator 0..1 pulse width modulat or txd0 uart 0 transmit data uart rxd0 uart 0 receive data uart cts0 uart 0 clear to send uart rts0 uart 0 request to send uart pcm_clk pcm clock pcm audio pcm_fs pcm frame sync pcm audio pcm_din pcm data in pcm audio pcm_dout pcm data out pcm audio sax secondary mem address bus secondary memory interfac e soe_n / se secondary mem. controls secondary memory interface swe_n / srw_n secondary mem. controls secondary memory interface sdx secondary mem. data bus secondary memory interface bscsl sda / mosi bsc slave data, spi salve mosi bsc isp slave bscsl scl / sclk bsc slave clock, spi slave clock bsc isp slave bscsl - / miso bsc ,spi miso bsc isp slave bscsl - / ce_n bsc , spi csn bsc isp slave 6 the broadcom serial control bus is a proprietary bus co mpliant with the philips ? i2c bus/interface
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 104 ? 2012 broadcom corporation. all rights reserved name function see section spi1_cex_n spi1 chip select 0-2 auxiliary i/o spi1_miso spi1 miso auxiliary i/o spi1_mosi spi1 mosi auxiliary i/o spi1_sclk spi1 serial clock auxiliary i/o txd0 uart 1 transmit data auxiliary i/o rxd0 uart 1 receive data auxiliary i/o cts0 uart 1 clear to send auxiliary i/o rts0 uart 1 request to send auxiliary i/o spi2_cex_n spi2 chip select 0-2 auxiliary i/o spi2_miso spi2 miso auxiliary i/o spi2_mosi spi2 mosi auxiliary i/o spi2_sclk spi2 serial clock auxiliary i/o arm_trst arm jtag reset arm_rtck arm jtag return clock arm_tdo arm jtag data out arm_tck arm jtag clock arm_tdi arm jtag data in arm_tms arm jtag mode select
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 105 ? 2012 broadcom corporation. all rights reserved 6.3 general purpose gpio clocks the general purpose clocks can be output to gpio pins. they run from the peripherals clock sources and use clock generators with noise-shaping mash dividers. these allow the gpio clocks to be used to drive audio devices. the fractional divider operates by periodically dropping s ource clock pulses, therefore the output frequency will periodically switch between: divi frequency source _ & 1 _ + divi frequency source jitter is therefore reduced by increasing the source clock f requency. in applications where jitter is a concern, the fastest available clock sourc e should be used. the general purpose clocks have mash noise-shaping divide rs which push this fractional divider jitter out of the audio band. mash noise-shaping is incorporated to push the fractional divider jitter out of the audio band if required. the mash can be programmed for 1, 2 or 3-stage filtering. mash filter, the frequency is spread around the requested frequency and the user must ensure that the module is not exposed to frequencies higher than 25mhz. also, the mash filter imposes a low limit on the range of divi. mash min divi min output freq average output freq max output freq 0 (int divide) 1 source / ( divi ) source / ( divi ) source / ( divi ) 1 2 source / ( divi ) source / ( divi + divf / 1024 ) source / ( divi + 1 ) 2 3 source / ( divi - 1 ) source / ( divi + divf / 1024 ) source / ( divi + 2 ) 3 5 source / ( divi - 3 ) source / ( divi + divf / 1024 ) source / ( divi + 4 ) table 6-32 effect of mash filter on frequency the following example illustrates the spreading of output clock frequency resulting from the use of the mash filter. note that the spread is greater for lower divisors. pll freq (mhz) target freq (mhz) mash divisor divi divf min freq (mhz) ave freq (mhz) max freq (mhz) error 650 18.32 0 35.480 35 492 18.57 18.57 18.57 ok 650 18.32 1 35.480 35 492 18.06 18.32 18.57 ok 650 18.32 2 35.480 35 492 17.57 18.32 19.12 ok 650 18.32 3 35.480 35 492 16.67 18.32 20.31 ok 400 18.32 0 21.834 21 854 19.05 19.05 19.05 ok 400 18.32 1 21.834 21 854 18.18 18.32 19.05 ok 400 18.32 2 21.834 21 854 17.39 18.32 20.00 ok 400 18.32 3 21.834 21 854 16.00 18.32 22.22 ok 200 18.32 0 10.917 10 939 20.00 20.00 20.00 ok 200 18.32 1 10.917 10 939 18.18 18.32 20.00 ok 200 18.32 2 10.917 10 939 16.67 18.32 22.22 ok 200 18.32 3 10.917 10 939 14.29 18.32 28.57 error table 6-33 example of frequency spread when using m ash filtering it is beyond the scope of this specification to describe the operation of a mash filter or to determine under what conditions the available levels of f iltering are beneficial.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 106 ? 2012 broadcom corporation. all rights reserved operating frequency the maximum operating frequency of the general purpose clo cks is ~125mhz at 1.2v but this will be reduced if the gpio pins are heavily loaded or have a capacitive load.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 107 ? 2012 broadcom corporation. all rights reserved register definitions clock manager general purpose clocks control (cm_gp 0ctl, gp1ctl & gp2ctl) address 0x 7e10 1070 cm_gp0ctl 0x 7e10 1078 cm_gp1ctl 0x 7e10 1080 cm_gp2ctl bit number field name description read/ write reset 31-24 passwd clock manager password ?5a? w 0 23-11 - unused r 0 10-9 mash mash control 0 = integer division 1 = 1-stage mash (equivalent to non-mash dividers) 2 = 2-stage mash 3 = 3-stage mash to avoid lock-ups and glitches do not change this control while busy=1 and do not change this control at the same time as asserting enab. r/w 0 8 flip invert the clock generator output this is intended for use in test/debug only. switch ing this control will generate an edge on the clock generator output. to avoid output glitches do not switch this control while busy=1. r/w 0 7 busy clock generator is running indicates the clock generator is running. to avoid glitches and lock-ups, clock sources and setups mus t not be changed while this flag is set. r 0 6 - unused r 0 5 kill kill the clock generator 0 = no action 1 = stop and reset the clock generator this is intended for test/debug only. using this co ntrol may cause a glitch on the clock generator output. r/w 0 4 enab enable the clock generator this requests the clock to start or stop without glitches. the output clock will not stop immediatel y because the cycle must be allowed to complete to avoid glitches. the busy flag will go low when the final cycle is completed. r/w 0 3-0 src clock source 0 = gnd 1 = oscillator 2 = testdebug0 3 = testdebug1 4 = plla per 5 = pllc per 6 = plld per 7 = hdmi auxiliary 8-15 = gnd to avoid lock-ups and glitches do not change this control while busy=1 and do not change this control at the same time as asserting enab. r/w 0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 108 ? 2012 broadcom corporation. all rights reserved table 6-34 general purpose clocks control clock manager general purpose clock divisors (cm_gp 0div, cm_gp1div & cm_gp2div) address 0x 7e10 1074 cm_gp0div 0x 7e10 107c cm_gp1div 0x 7e10 1084 cm_gp2div bit number field name description read/ write reset 31-24 passwd clock manager password ?5a? w 0 23-12 divi integer part of divisor this value has a minimum limit determined by the mash setting. see text for details. to avoid lock-u ps and glitches do not change this control while busy= 1. r/w 0 11-0 divf fractional part of divisor to avoid lock-ups and glitches do not change this control while busy=1. r/w 0 table 6-35 general purpose clock divisors
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 109 ? 2012 broadcom corporation. all rights reserved 7 interrupts 7.1 introduction the arm has two types of interrupt sources: 1. interrupts coming from the gpu peripherals. 2. interrupts coming from local arm control peripheral s. the arm processor gets three types of interrupts: 1. interrupts from arm specific peripherals. 2. interrupts from gpu peripherals. 3. special events interrupts. the arm specific interrupts are: ? one timer. ? one mailbox. ? two doorbells. ? two gpu halted interrupts. ? two address/access error interrupt the mailbox and doorbell registers are not for gene ral usage. for each interrupt source (arm or gpu) there is an interrupt enable bit (read/write) and an interrupt pending bit (read only). all interrupts generated b y the arm control block are level sensitive interrupts. thus all interrupts remain asserted unt il disabled or the interrupt source is cleared. default the interrupts from doorbell 0,1 and mailbo x 0 go to the arm this means that these resources should be written by the gpu and read by the arm. the opposite holds for doorbells 2, 3 and mailbox 1.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 110 ? 2012 broadcom corporation. all rights reserved 7.2 interrupt pending. an interrupt vector module has not been implemented . to still have adequate interrupt processing the interrupt pending bits are organized as follows : arm irqs vc irqs 0-31 gpu irqs 32-63 basic pend. gpu pend. 0 gpu pend. 1 a few selected gpu irqs see text there are three interrupt pending registers. one basic pending register and two gpu pending regi sters. basic pending register. the basic pending register has interrupt pending bi ts for the arm specific interrupts . to speed up the interrupt processing it also has a number of selected gpu interrupts which are deemed most likely to be required in arm drivers. further there are two special gpu pending bits whic h tell if any of the two other pending registers has bits set, one bit if a gpu interrupt 0-31 is pe nding, a second bit if a gpu interrupt 32-63 is pending. the 'selected gpu interrupts' on the basic pending registers are not taken into account for these two status bits. so the two pending 0,1 statu s bits tell you that 'there are more interrupt whic h you have not seen yet'. gpu pending registers. there are two gpu pending registers with one bit pe r gpu interrupt source. 7.3 fast interrupt (fiq). the arm also supports a fast interrupt (fiq). one i nterrupt sources can be selected to be connected to the arm fiq input. there is also one fiq enable. an interrupt which is selected as fiq should have its normal interrupt enable bit cleared. otherwise an normal and a fiq interrupt will be fired at the same time. not a good idea! 7.4 interrupt priority. there is no priority for any interrupt. if one inte rrupt is much more important then all others it can be routed to the fiq. any remaining interrupts have to be processed by polling the pending
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 111 ? 2012 broadcom corporation. all rights reserved registers. it is up to the arm software to device a strategy. e.g. first start looking for specific pe nding bits or process them all shifting one bit at a time . as interrupt may arrive whilst this process is ongo ing the usual care for any 'race-condition critical ' code must be taken. the following arm assembly code has been proven to work: .macro get_irqnr_preamble, base, tmp ldr \base, =io_address(armctrl_ic_base) .endm .macro get_irqnr_and_base, irqnr, irqstat, base, tmp ldr \irqstat, [\base, #(arm_irq_pend0 - armctrl_ ic_base)] @ get masked status mov \irqnr, #(arm_irq0_base + 31) and \tmp, \irqstat, #0x300 @ save bits 8 and 9 bics \irqstat, \irqstat, #0x300 @ clear bit s 8 and 9, and test bne 1010f tst \tmp, #0x100 ldrne \irqstat, [\base, #(arm_irq_pend1 - armctrl _ic_base)] movne \irqnr, #(arm_irq1_base + 31) @ mask out the interrupts also present in pend0 - see sw-5809 bicne \irqstat, #((1<<7) | (1<<9) | (1<<10)) bicne \irqstat, #((1<<18) | (1<<19)) bne 1010f tst \tmp, #0x200 ldrne \irqstat, [\base, #(arm_irq_pend2 - armctrl _ic_base)] movne \irqnr, #(arm_irq2_base + 31) @ mask out the interrupts also present in pend0 - see sw-5809 bicne \irqstat, #((1<<21) | (1<<22) | (1<<23) | ( 1<<24) | (1<<25)) bicne \irqstat, #((1<<30)) beq 1020f 1010: @ for non-zero x, lsb(x) = 31 - clz(x^(x-1)) @ n.b. clz is an arm5 instruction. sub \tmp, \irqstat, #1 eor \irqstat, \irqstat, \tmp clz \tmp, \irqstat sub \irqnr, \tmp 1020: @ eq will be set if no irqs pending
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 112 ? 2012 broadcom corporation. all rights reserved .endm 7.5 registers the base address for the arm interrupt register is 0x7e00b000. registers overview: address offset 7 name notes 0x200 irq basic pending 0x204 irq pending 1 0x208 irq pending 2 0x20c fiq control 0x210 enable irqs 1 0x214 enable irqs 2 0x218 enable basic irqs 0x21c disable irqs 1 0x220 disable irqs 2 0x224 disable basic irqs the following is a table which lists all interrupts which can come from the peripherals which can be handled by the arm. 7 this is the offset which needs to be added to the base address to get the full hardware address.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 113 ? 2012 broadcom corporation. all rights reserved arm peripherals interrupts table. # irq 0 - 15 # irq 16 - 31 # irq 32 - 47 # irq 48 - 63 0 16 32 48 smi 1 17 33 49 gpio_int[0] 2 18 34 50 gpio_int[1] 3 19 35 51 gpio_int[2] 4 20 36 52 gpio_int[3] 5 21 37 53 i2c_int 6 22 38 54 spi_int 7 23 39 55 pcm_int 8 24 40 56 9 25 41 57 uart_int 10 26 42 58 11 27 43 i2c_spi_slv_int 59 12 28 44 60 13 29 aux int 45 pwa0 61 14 30 46 pwa1 62 15 31 47 63 the table above has many empty entries. these shoul d not be enabled as they will interfere with the gpu operation. arm peripherals interrupts table. 0 arm timer 1 arm mailbox 2 arm doorbell 0 3 arm doorbell 1 4 gpu0 halted (or gpu1 halted if bit 10 of control r egister 1 is set) 5 gpu1 halted 6 illegal access type 1 7 illegal access type 0 basic pending register. the basic pending register shows which interrupt ar e pending. to speed up interrupts processing, a number of 'normal' interrupt status bits have been added to this register. this makes the 'irq pending base' register different from the other 'base' interrupt registers name: irq pend base address: 0x200 reset: 0x000 bit(s) r/w function 31:21 - 20 r gpu irq 62
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 114 ? 2012 broadcom corporation. all rights reserved name: irq pend base address: 0x200 reset: 0x000 19 r gpu irq 57 18 r gpu irq 56 17 r gpu irq 55 16 r gpu irq 54 15 r gpu irq 53 14 r gpu irq 19 13 r gpu irq 18 12 r gpu irq 10 11 r gpu irq 9 10 r gpu irq 7 9 r one or more bits set in pending register 2 8 r one or more bits set in pending register 1 7 r illegal access type 0 irq pending 6 r illegal access type 1 irq pending 5 r gpu1 halted irq pending 4 r gpu0 halted irq pending (or gpu1 halted if bit 10 of control register 1 is set) 3 r arm doorbell 1 irq pending 2 r arm doorbell 0 irq pending 1 r arm mailbox irq pending 0 r arm timer irq pending gpu irq x (10,11..20) these bits are direct interrupts from the gpu. they have been selected as interrupts which are most likely to be useful to the arm. the gpu interrupt s elected are 7, 9, 10, 18, 19, 53,54,55,56,57,62. fo r details see the gpu interrupts table . bits set in pending registers (8,9) these bits indicates if there are bits set in the p ending 1/2 registers. the pending 1/2 registers hol d all interrupts 0..63 from the gpu side. some of the se 64 interrupts are also connected to the basic pending register. any bit set in pending register 1 /2 which is not connected to the basic pending register causes bit 8 or 9 to set. status bits 8 an d 9 should be seen as "there are some interrupts pending which you don't know about. they are in pen ding register 1 /2." illegal access type-0 irq (7) this bit indicate that the address/access error lin e from the arm processor has generated an interrupt. that signal is asserted when either an a ddress bit 31 or 30 was high or when an access was
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 115 ? 2012 broadcom corporation. all rights reserved seen on the arm peripheral bus. the status of that signal can be read from error/halt status register bit 2. illegal access type-1 irq (6) this bit indicates that an address/access error is seen in the arm control has generated an interrupt. that can either be an address bit 29..26 was high o r when a burst access was seen on the gpu peripheral bus. the status of that signal can be re ad from error/halt status register bits 0 and 1. gpu-1 halted irq (5) this bit indicate that the gpu-1 halted status bit has generated an interrupt. the status of that sign al can be read from error/halt status register bits 4. gpu-0 (or any gpu) halted irq (4) this bit indicate that the gpu-0 halted status bit has generated an interrupt. the status of that sign al can be read from error/halt status register bits 3. in order to allow a fast interrupt (fiq) routine to cope with gpu 0 or gpu-1 there is a bit in control register 1 which, if set will also route a gpu-1 ha lted status on this bit. standard peripheral irqs (0,1,2,3) these bits indicate if an interrupt is pending for one of the arm control peripherals. gpu pending 1 register. name: irq pend base address: 0x204 reset: 0x000 bit(s) r/w function 31:0 r irq pending source 31:0 (see irq table above) this register holds all interrupts 0..31 from the g pu side. some of these interrupts are also connected to the basic pending register. any interr upt status bit in here which is not connected to the basic pending will also cause bit 8 of the basi c pending register to be set. that is all bits exce pt 7, 9, 10, 18, 19. gpu pending 2 register. name: irq pend base address: 0x208 reset: 0x000 bit(s) r/w function 31:0 r irq pending source 63:32 (see irq table above) this register holds all interrupts 32..63 from the gpu side. some of these interrupts are also connected to the basic pending register. any interr upt status bit in here which is not connected to the basic pending will also cause bit 9 of the basi c pending register to be set. that is all bits exce pt . register bits 21..25, 30 (interrupts 53..57,62). fiq register. the fiq register control which interrupt source can generate a fiq to the arm. only a single interrupt can be selected.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 116 ? 2012 broadcom corporation. all rights reserved name: fiq address: 0x20c reset: 0x000 bit(s) r/w function 31:8 r 7 r fiq enable. set this bit to 1 to enable fiq generat ion. if set to 0 bits 6:0 are don't care. 6:0 r/w select fiq source fiq source. the fiq source values 0-63 correspond to the gpu in terrupt table. (see above) the following values can be used to route arm speci fic interrupts to the fiq vector/routine: fiq index source 0 - 63 gpu interrupts (see gpu irq table) 64 arm timer interrupt 65 arm mailbox interrupt 66 arm doorbell 0 interrupt 67 arm doorbell 1 interrupt 68 gpu0 halted interrupt (or gpu1) 69 gpu1 halted interrupt 70 illegal access type - 1 interrupt 71 illegal access type - 0 interrupt 72 - 127 do not use interrupt enable register 1. name: irq enable 1 address: 0x210 reset: 0x000 bit(s) r/w function 31:0 r/wbs set to enable irq source 31:0 (see irq table above) writing a 1 to a bit will set the corresponding irq enable bit. all other irq enable bits are unaffected. only bits which are enabled can be seen in the interrupt pending registers. there is no provision here to see if there are interrupts which are pending but not enabled.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 117 ? 2012 broadcom corporation. all rights reserved interrupt enable register 2. name: irq enable 2 address: 0x214 reset: 0x000 bit(s) r/w function 31:0 r/wbs set to enable irq source 63:32 (see irq table above ) writing a 1 to a bit will set the corresponding irq enable bit. all other irq enable bits are unaffected. only bits which are enabled can be seen in the interrupt pending registers. there is no provision here to see if there are interrupts which are pending but not enabled. base interrupt enable register. name: irq enable 3 address: 0x218 reset: 0x000 bit(s) r/w function 31:8 r/wbs 7 r/wbs set to enable access error type - 0 irq 6 r/wbs set to enable access error type - 1 irq 5 r/wbs set to enable gpu 1 halted irq 4 r/wbs set to enable gpu 0 halted irq 3 r/wbs set to enable arm doorbell 1 irq 2 r/wbs set to enable arm doorbell 0 irq 1 r/wbs set to enable arm mailbox irq 0 r/wbs set to enable arm timer irq writing a 1 to a bit will set the corresponding irq enable bit. all other irq enable bits are unaffected. again only bits which are enabled can b e seen in the basic pending register. there is no provision here to see if there are interrupts which are pending but not enabled. interrupt disable register 1. name: irq disable 1 address: 0x21c reset: 0x000 bit(s) r/w function 31:0 r/wbc set to disable irq source 31:0 (see irq table above ) writing a 1 to a bit will clear the corresponding i rq enable bit. all other irq enable bits are unaffected.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 118 ? 2012 broadcom corporation. all rights reserved interrupt disable register 2. name: irq disable 2 address: 0x220 reset: 0x000 bit(s) r/w function 31:0 r/wbc set to disable irq source 63:32 (see irq table abov e) writing a 1 to a bit will clear the corresponding i rq enable bit. all other irq enable bits are unaffected. base disable register. name: irq disable 3 address: 0x224 reset: 0x000 bit(s) r/w function 31:8 - 7 r/wbc set to disable access error type - 0 irq 6 r/wbc set to disable access error type - 1 irq 5 r/wbc set to disable gpu 1 halted irq 4 r/wbc set to disable gpu 0 halted irq 3 r/wbc set to disable arm doorbell 1 irq 2 r/wbc set to disable arm doorbell 0 irq 1 r/wbc set to disable arm mailbox irq 0 r/wbc set to disable arm timer irq writing a 1 to a bit will clear the corresponding i rq enable bit. all other irq enable bits are unaffected.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 119 ? 2012 broadcom corporation. all rights reserved 8 pcm / i2s audio the pcm audio interface is an apb peripheral providin g input and output of telephony or high quality serial audio streams. it supports many classi c pcm formats including i2s. the pcm audio interface has 4 interface signals; pcm_clk - bit clock. pcm_fs - frame sync signal. pcm_din - serial data input. pcm_dout - serial data output. pcm is a serial format with a single bit data_in and si ngle bit data_out. data is always serialised ms-bit first. the frame sync signal (pcm_fs) is used to delimit the ser ial data into individual frames. the length of the frame and the size and position of the fr ame sync are fully programmable. frames can contain 1 or 2 audio/data channels in each dir ection. each channel can be between 8 and 32 bits wide and can be positioned anywhere wit hin the frame as long as the two channels don?t overlap. the channel format is sepa rately programmable for transmit and receive directions. pcm_clk pcm_fs ms ls ch. 1 ms ls ch. 2 pcm_din pcm_dout ch1pos ch1wid ch2wid ch2pos fslen flen ms ls ch. 1 ms ls ch. 2 ch1pos ch1wid ch2wid ch2pos figure 8-1 pcm audio interface typical timing the pcm_clk can be asynchronous to the bus apb clock a nd can be logically inverted if required. the direction of the pcm_clk and pcm_fs signals can be individually selected, allowing the interface to act as a master or slave device. the input interface is also capable of supporting up to 2 pdm microphones, as an alternative to the classic pcm input format, in conjunction with a p cm output.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 120 ? 2012 broadcom corporation. all rights reserved 8.1 block diagram figure 8-2 pcm audio interface block diagram the pcm audio interface contains separate transmit an d receive fifos. note that if the frame contains two data channels, they must share the same f ifo and so the channel data will be interleaved. the block can be driven using simple polling, an interrupt based method or direct dma control. 8.2 typical timing figure 8-1 shows typical interface timing and indicates th e flexibility that the peripheral offers. normally pcm output signals change on the rising edge of pcm_clk and input signals are sampled on its falling edge. the frame sync is considered as a data signal and sampled in the same way. the front end of the pcm audio interface is run off th e pcm_clk and the pcm signals are timed against this clock. however, the polarity of the pcm_clk can be physically inverted, in which case the edges are reversed. in clock master mode (clkm=0), the pcm_clk is an output a nd is driven from the pcm_mclk clock input. in clock slave mode (clkm=1), the pcm_clk is an input, suppli ed by some external clock source.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 121 ? 2012 broadcom corporation. all rights reserved in frame sync master mode (fsm=0), the pcm_fs is inter nally generated and is treated as a data output that changes on the positive edge of the cloc k. the length and polarity of the frame sync is fully programmable and it can be used as a s tandard frame sync signal, or as an l-r signal for i2s. in frame sync slave mode (fsm=1), the pcm_fs is treated as a data input and is sampled on the negative edge of pcm_clk. the first clock of a fra me is taken as the first clock period where pcm_fs is sampled as a 1 following a period or periods where it was previously a 0. the pcm audio interface locks onto the incoming frame sync and uses this to indicate where the data channels are positioned. the precise timing at t he start of frame is shown in figure 8-3. note that in frame sync slave mode there are two synchro nising methods. the legacy method is used when the frame length = 0. in this case the inte rnal frame logic has to detect the incoming pcm_fs signal and reset the internal frame coun ter at the start of every frame. the logic relies on the pcm_fs to indicate the length of the frame and so can cope with adjacent frames of different lengths. however, this cr eates a short timing path that will corrupt the pcm_dout for one specific frame/channel sett ing. the preferred method is to set the frame length to the expected length. here the incoming pcm_fs is used to resynchronise the internal frame count er and this eliminates the short timing path. 8.3 operation the pcm interface runs asynchronously at the pcm_clk rat e and automatically transfers transmit and receive data across to the internal apb c lock domain. the control registers are not synchronised and should be programmed before the device is enabled and should not be changed whilst the interface is running. only the en, rxon and txon bits of the pcmcs register are synchronised across the pcm - apb clock domain and are allowed to be changed whils t the interface is running. the en bit is a global power-saving enable. the txon and rx on bits enable transmit and receive, and the interface is running whenever either txon or rxon is enabled. in operation, the pcm format is programmed by setting the appropriate frame length, frame sync, channel position values, and signal polarity controls . the transmit fifo should be preloaded with data and the interface can then be enabled and started, and will run continuously until stopped. if the transmit fifo become s empty or the receive fifo becomes full, the rxerr or txerr error flags will be set, but the interface will just continue. if the rx fifo overflows, new samples are discarded and if the tx fifo underflows, zeros are transmitted. normally channel data is read or written into the appropri ate fifo as a single word. if the channel is less than 32 bits, the data is right justified and should be padded with zeros. if the rxsex bit is set then the received data is sign extended up to the full 32 bits. when a frame is programmed to have two data channels, then each channel is written/read as a separate word in the fifo, producing an interleaved data stream. wh en initialising the interface, the first word read out of the tx fifo will be used for the first channel, and the data from the first channel on the first frame to be received will b e the first word written into the rx fifo. if a fifo error occurs in a two channel frame, then c hannel synchronisation may be lost which may result in a left right audio channel swap. rx sync and txsync status bits are
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 122 ? 2012 broadcom corporation. all rights reserved provided to help determine if channel slip has occurred. they i ndicate if the number of words in the fifo is a multiple of a full frame (taking in to account where we are in the current frame being transferred). this assumes that an integer n umber of frames data has been sent/read from the fifos. if a frame is programmed to have two data channels and the packed mode bits are set (frxp ftxp) then the fifos are configured so that each word co ntains the data for both channels (2x 16 bit samples). in this mode each word written to the tx fifo contains 2 16 bit samples, and the least significant sample is transmit ted first. each word read from the rx fifo will contain the data received from 2 channels, the f irst channel received will be in the least significant half of the word. if the channels si ze is less than 16 bits, the tx data will be truncated and rx data will be padded to 16 bits with zeros. note that data is always serialised ms-bit first. this i s well-established behaviour in both pcm and i2s. if the pdm input mode is enabled then channel 1 is sampled on the negative edge of pcm_clk whilst channel 2 is sampled on the positive edge of pcm_clk. pcm_clk pcm_fs clock 0 pcm_din pcm_dout clock 1 sampling window clock 2 figure 8-3 timing at start of frame note that the precise timing of fs (when it is an input) i s not clearly defined and it may change state before or after the positive edge of the clock. here the first clock of the frame is defined as the clock period where the pcm_fs is sampled (n egative edge) as a 1 where it was previously sampled as a 0. 8.4 software operation 8.4.1 operating in polled mode set the en bit to enable the pcm block. set all operatio nal values to define the frame and channel settings. assert rxclr and/or txclr wait for 2 pcm clocks to ensure the fifos are reset. the sync bit can be used to determine w hen 2 clocks have passed. set rxthr/txthr to determine the fifo thresholds.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 123 ? 2012 broadcom corporation. all rights reserved if transmitting, ensure that sufficient sample words ha ve been written to pcmfifo before transmission is started. set txon and/or rxo n to begin operation. poll txw writing sample words to pcmfifo and rxr reading sam ple words from pcmfifo until all data is transferred. 8.4.2 operating in interrupt mode a) set the en bit to enable the pcm block. set all operatio nal values to define the frame and channel settings. assert rxclr and/or txclr wait fo r 2 pcm clocks to ensure the fifos are reset. the sync bit can be used to determ ine when 2 clocks have passed. set rxthr/txthr to determine the fifo thresholds. b) set intr and/or intt to enable interrupts. c) if transmitting, ensure that sufficient sample words ha ve been written to pcmfifo before transmission is started. set txon and/or rxon to begin operation. d) when an interrupt occurs, check rxr. if this is set then one or more sample words are available in pcmfifo. if txw is set then one or mo re sample words can be sent to pcmfifo. 8.4.3 dma a) set the en bit to enable the pcm block. set all operatio nal values to define the frame and channel settings. assert rxclr and/or txclr wait fo r 2 pcm clocks to ensure the fifos are reset. the sync bit can be used to determ ine when 2 clocks have passed. b) set dmaen to enable dma dreq generation and set rxreq/txreq to det ermine the fifo thresholds for the dreqs. if required, set txpanic and rxpanic to determine the level at which the dma should increase it s axi priority, c) in the dma controllers set the correct dreq channels , one for rx and one for tx. start the dma which should fill the tx fifo. d) set txon and/or rxon to begin operation. 8.5 error handling. in all software operational modes, the possibility of fifo over or under run exists. should this happen when using 2 channels per frame, there is a risk of losing sync with the channel data stored in the fifo. if this happens and is not detected a nd corrected, then the data channels may become swapped. the fifos will automatically detect an error condi tion caused by a fifo over or under-run and this will set the appropriate latching error bit in the control/status register. writing a 1 back to this error bit will clear the latched flag. in a system using a polled operation, the error bit s can be checked manually. for an interrupt or dma based system, setting the inte bit will cause t he pcm interface to generate an interrupt when an error is detected.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 124 ? 2012 broadcom corporation. all rights reserved if a fifo error occurs during operation in which 2 data channels are being used then the synchronisation of the data may be lost. this can b e recovered by either of these two methods: a) disable transmit and receive (txon and rxon =0). clear the fifo?s (rxclr and txclr =1). note that it may take up to 2 pcm clocks for t he fifos to be physically cleared after initiating a clear. then preload the trans mit fifo and restart transmission. this of course loses the data in the fif o and further interrupts the data flow to the external device. b) examine the txsync and rxsync flags. these flags in dicate if the amount of data in the fifo is a whole number of frames, automatically taking i nto account where we are in the current frame being transmitted or received. thus, providi ng an even number of samples was read or written to the fifos, then if the flags are set then this indicates that a single word needs to be written or read to adjust the data. normal ex change of data can then proceed (where the first word in a data pair is for channel 1). th is method should cause less disruption to the data stream. 8.6 pdm input mode operation the pdm input mode is capable of interfacing with two digita l half-cycle pdm microphones and implements a 4 th order cic decimation filter with a selectable decimati on factor. the clock input of the microphones is shared with the pcm output codec and it should be configured to provide the correct clock rate for the micr ophones. as a result it may be necessary to add a number of padding bits into the pcm output and configure the output codec to allow for this. when using the pdm input mode the bit width and the rate of t he data received will depend on the decimation factor used. once the data has been r ead from the peripheral a further decimation and filtering stage will be required and can be i mplemented in software. the software filter should also correct the droop introduced by the cic filter stage. similarly a dc correction stage should also be employed. pdmn pcm_clk (mhz) peripheral output format osr fs 0 (n=16) 3.072 16 bits unsigned 4 48khz 1 (n=32) 3.072 20 bits unsigned 2 48khz table 8-1 pdm input mode configuration 8.7 gray code input mode operation gray mode is used for an incoming data stream only. gray mo de is selected by setting the enable bit (en) in the pcm_gray register. in this mode data is received on the pcm_din (data) and the pcm_fs (strobe) pins. the data is expected to be in data/strobe format. in this m ode data is detected when either the data or the strobe change state. as each bit is receiv ed it is written into the rx buffer and when 32 bits are received they are written out to the rx fifo as a 32 bit word. in order for this mode to work the user must program a pcm clock rate whi ch is 4 times faster then the gray data rate. also the gray coded data input signals shoul d be clean.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 125 ? 2012 broadcom corporation. all rights reserved the normal rxreq and rxthr fifo levels will apply as for normal pcm received data. if a message is received that is not a multiple of 32 bit s, any data in the rx buffer can be flushed out by setting the flush bit (flush). once set, t his bit will read back as zero until the flush operation has completed. this may take several cycl es as the apb clock may be many times faster than the pcm clock. once the flush has occurred, the bits are packed up to 32 bits with zeros and written out to the rxfifo. the fl ushed field (flushed) will indicate how many of bits of this word are valid. note that to get an accurate indication of the number of bits currently in the rx shift register (rxlevel) the apb clock must be at least 2x the pcm_cl k. figure 8-4 gray mode input format 8.8 pcm register map there is only pcm module in the BCM2835. the pcm base address for the registers is 0x7e203000. pcm address map address offset register name description size 0x0 cs_a pcm control and status 32 0x4 fifo_a pcm fifo data 32 0x8 mode_a pcm mode 32 0xc rxc_a pcm receive configuration 32 0x10 txc_a pcm transmit configuration 32 0x14 dreq_a pcm dma request level 32
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 126 ? 2012 broadcom corporation. all rights reserved 0x18 inten_a pcm interrupt enables 32 0x1c intstc_a pcm interrupt status & clear 32 0x20 gray pcm gray mode control 32 cs_a register synopsis this register contains the main control and status bi ts for the pcm. the bottom 3 bits of this register can be written to whilst the pcm is running. the remaining bits cannot. bit(s) field name description type reset 31:26 reserved - write as 0, read as don't care 25 stby ram standby this bit is used to control the pcm rams standby mode. by default this bit is 0 causing rams to start initially in standby mode. rams should be released from standby prior to any transmit/receive operation. allow for at least 4 pcm clock cycles to take effect. this may or may not be implemented, depending upon the ram libraries being used. rw 0x0 24 sync pcm clock sync helper. this bit provides a software synchronisation mechanism to allow the software to detect when 2 pcm clocks have occurred. it takes 2 pcm clocks before the value written to this bit will be echoed back in the read value. rw 0x0 23 rxsex rx sign extend 0 = no sign extension. 1 = sign extend the rx data. when set, the msb of the received data channel (as set by the chxwid parameter) is repeated in all the higher data bits up to the full 32 bit data width. rw 0x0 22 rxf rx fifo is full 0 = rx fifo can accept more data. 1 = rx fifo is full and will overflow if more data is received. ro 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 127 ? 2012 broadcom corporation. all rights reserved 21 txe tx fifo is empty 0 = tx fifo is not empty. 1 = tx fifo is empty and underflow will take place if no more data is written. ro 0x1 20 rxd indicates that the rx fifo contains data 0 = rx fifo is empty. 1 = rx fifo contains at least 1 sample. ro 0x0 19 txd indicates that the tx fifo can accept data 0 = tx fifo is full and so cannot accept more data. 1 = tx fifo has space for at least 1 sample. ro 0x1 18 rxr indicates that the rx fifo needs reading 0 = rx fifo is less than rxthr full. 1 = rx fifo is rxthr or more full. this is cleared by reading sufficient data from the rx fifo. ro 0x0 17 txw indicates that the tx fifo needs writing 0 = tx fifo is at least txthr full. 1 = tx fifo is less then txthr full. this is cleared by writing sufficient data to the tx fifo. ro 0x1 16 rxerr rx fifo error 0 = fifo has had no errors. 1 = fifo has had an under or overflow error. this flag is cleared by writing a 1. rw 0x0 15 txerr tx fifo error 0 = fifo has had no errors. 1 = fifo has had an under or overflow error. this flag is cleared by writing a 1. rw 0x0 14 rxsync rx fifo sync 0 = fifo is out of sync. the amount of data left in the fifo is not a multiple of that required for a frame. this takes into account if we are halfway through the frame. 1 = fifo is in sync. ro 0x0 13 txsync tx fifo sync 0 = fifo is out of sync. the amount of data left in the fifo is not a multiple of that required for a frame. this takes into account if we are halfway through the frame. 1 = fifo is in sync. ro 0x0 12:10 reserved - write as 0, read as don't care
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 128 ? 2012 broadcom corporation. all rights reserved 9 dmaen dma dreq enable 0 = don t generate dma dreq requests. 1 = generates a tx dma dreq requests whenever the tx fifo level is lower than txreq or generates a rx dma dreq when the rx fifo level is higher than rxreq. rw 0x0 8:7 rxthr sets the rx fifo threshold at which point the rxr flag is set 00 = set when we have a single sample in the rx fifo 01 = set when the rx fifo is at least full 10 = set when the rx fifo is at least 11 = set when the rx fifo is full rw 0x0 6:5 txthr sets the tx fifo threshold at which point the txw flag is set 00 = set when the tx fifo is empty 01 = set when the tx fifo is less than full 10 = set when the tx fifo is less than full 11 = set when the tx fifo is full but for one sample rw 0x0 4 rxclr clear the rx fifo . assert to clear rx fifo. this bit is self clearing and is always read as clear note that it will take 2 pcm clocks for the fifo to be physically cleared. wo 0x0 3 txclr clear the tx fifo assert to clear tx fifo. this bit is self clearing and is always read as clear. note that it will take 2 pcm clocks for the fifo to be physically cleared. wo 0x0 2 txon enable transmission 0 = stop transmission. this will stop immediately if possible or else at the end of the next frame. the tx fifo can still be written to to preload data. 1 = start transmission. this will start transmittin g at the start of the next frame. once enabled, the first data read from the tx fifo will be placed in the first channel of the frame, thus ensuring proper channel synchronisation. the frame counter will be started whenever txon or rxon are set. this bit can be written whilst the interface is running. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 129 ? 2012 broadcom corporation. all rights reserved 1 rxon enable reception. 0 = disable reception. this will stop on the next available frame end. rx fifo data can still be read. 1 = enable reception. this will be start receiving at the start of the next frame. the first channel to be received will be the first word written to the rx fifo. this bit can be written whilst the interface is running. rw 0x0 0 en enable the pcm audio interface 0 = the pcm interface is disabled and most logic is gated off to save power. 1 = the pcm interface is enabled. this bit can be written whilst the interface is running. rw 0x0 fifo_a register synopsis this is the fifo port of the pcm. data written here is transmitted, and received data is read from here. bit(s) field name description type reset 31:0 reserved - write as 0, read as don't care mode_a register synopsis this register defines the basic pcm operating mode. it is used to configure the frame size and format and whether the pcm is in master or slave modes for its frame sync or clock. this register cannot be changed whilst the pcm i s running. bit(s) field name description type reset 31:29 reserved - write as 0, read as don't care
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 130 ? 2012 broadcom corporation. all rights reserved 28 clk_dis pcm clock disable 1 = disable the pcm clock. this cleanly disables the pcm clock. this enables glitch free clock switching between an internal and an uncontrollable external clock. the pcm clock can be disabled, and then the clock source switched, and then the clock re- enabled. 0 = enable the pcm clock. rw 0x0 27 pdmn pdm decimation factor (n) 0 = decimation factor 16. 1 = decimation factor 32. sets the decimation factor of the cic decimation filter. rw 0x0 26 pdme pdm input mode enable 0 = disable pdm (classic pcm input). 1 = enable pdm input filter. enable cic filter on input pin for pdm inputs. in order to receive data rxon must also be set. rw 0x0 25 frxp receive frame packed mode 0 = the data from each channel is written into the rx fifo. 1 = the data from both rx channels is merged (1st channel is in the ls half) and then written to the rx fifo as a single 2x16 bit packed mode word. first received channel in the frame goes into the ls half word. if the received data is larger than 16 bits, the upper bits are truncated. the maximum channel size is 16 bits. rw 0x0 24 ftxp transmit frame packed mode 0 = each tx fifo word is written into a single channel. 1 = each tx fifo word is split into 2 16 bit words and used to fill both data channels in the same frame. the maximum channel size is 16 bits. the ls half of the word is used in the first channel of the frame. rw 0x0 23 clkm pcm clock mode 0 = master mode. the pcm clk is an output and drives at the mclk rate. 1 = slave mode. the pcm clk is an input. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 131 ? 2012 broadcom corporation. all rights reserved 22 clki clock invert this logically inverts the pcm_clk signal. 0 = outputs change on rising edge of clock, inputs are sampled on falling edge. 1 = outputs change on falling edge of clock, inputs are sampled on rising edge. rw 0x0 21 fsm frame sync mode 0 = master mode. the pcm_fs is an output and we generate the frame sync. 1 = slave mode. the pcm_fs is an input and we lock onto the incoming frame sync signal. rw 0x0 20 fsi frame sync invert this logically inverts the frame sync signal. 0 = in master mode, fs is normally low and goes high to indicate frame sync. in slave mode, the frame starts with the clock where fs is a 1 after being a 0. 1 = in master mode, fs is normally high and goes low to indicate frame sync. in slave mode, the frame starts with the clock where fs is a 0 after being a 1. rw 0x0 19:10 flen frame length sets the frame length to (flen+1) clocks. used only when fsm == 0. 1 = frame length of 2 clocks. 2 = frame length of 3 clocks. etc rw 0x0 9:0 fslen frame sync length sets the frame sync length to (fslen) clocks. this is only used when fsm == 0. pcm_fs will remain permanently active if fslen >= flen. 0 = frame sync pulse is off. 1 = frame sync pulse is 1 clock wide. etc rw 0x0 rxc_a register synopsis sets the channel configurations for receiving. this s ets the position and width of the 2 receive channels within the frame. the two channels can not overlap, however they channel 1 can come after channel zero, although the firs t data will always be from the first channel in the frame. channels can also straddl e the frame begin end boundary as that is set by the frame sync position. this regist er cannot be changed whilst the pcm is running. bit(s) field name description type reset
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 132 ? 2012 broadcom corporation. all rights reserved 31 ch1wex channel 1 width extension bit this is the msb of the channel 1 width (ch1wid). it allows widths greater than 24 bits to be programmed and is added here to keep backwards compatibility with older versions of the pcm rw 0x0 30 ch1en channel 1 enable 0 = channel 1 disabled and no data is received from channel 1 and written to the rx fifo. 1 = channel 1 enabled. rw 0x0 29:20 ch1pos channel 1 position this sets the bit clock at which the first bit (ms bit) of channel 1 data occurs in the frame. 0 indicates the first clock of frame. rw 0x0 19:16 ch1wid channel 1 width this sets the width of channel 1 in bit clocks. this field has been extended with the ch1wex bit giving a total width of (ch1wex* 16) + ch1wid + 8. the maximum supported width is 32 bits. 0 = 8 bits wide 1 = 9 bits wide rw 0x0 15 ch2wex channel 2 width extension bit this is the msb of the channel 2 width (ch2wid). it allows widths greater than 24 bits to be programmed and is added here to keep backwards compatibility with older versions of the pcm rw 0x0 14 ch2en channel 2 enable 0 = channel 2 disabled and no data is received from channel 2 and written to the rx fifo. 1 = channel 2 enabled. rw 0x0 13:4 ch2pos channel 2 position this sets the bit clock at which the first bit (ms bit) of channel 2 data occurs in the frame. 0 indicates the first clock of frame. rw 0x0 3:0 ch2wid channel 2 width this sets the width of channel 2 in bit clocks. this field has been extended with the ch2wex bit giving a total width of (ch2wex* 16) + ch2wid + 8. the maximum supported width is 32 bits. 0 = 8 bits wide 1 = 9 bits wide rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 133 ? 2012 broadcom corporation. all rights reserved txc_a register synopsis sets the channel configurations for transmitting. th is sets the position and width of the 2 transmit channels within the frame. the two cha nnels cannot overlap, however they channel 1 can come after channel zero, although the first data will always be used in the first channel in the frame. channels can also straddle the frame begin end boundary as that is set by the frame sync position. thi s register cannot be changed whilst the pcm is running. bit(s) field name description type reset 31 ch1wex channel 1 width extension bit this is the msb of the channel 1 width (ch1wid). it allows widths greater than 24 bits to be programmed and is added here to keep backwards compatibility with older versions of the pcm rw 0x0 30 ch1en channel 1 enable 0 = channel 1 disabled and no data is taken from the tx fifo and transmitted on channel 1. 1 = channel 1 enabled. rw 0x0 29:20 ch1pos channel 1 position this sets the bit clock at which the first bit (ms bit) of channel 1 data occurs in the frame. 0 indicates the first clock of frame. rw 0x0 19:16 ch1wid channel 1 width this sets the width of channel 1 in bit clocks. this field has been extended with the ch1wex bit giving a total width of (ch1wex* 16) + ch1wid + 8. the maximum supported width is 32 bits. 0 = 8 bits wide 1 = 9 bits wide rw 0x0 15 ch2wex channel 2 width extension bit this is the msb of the channel 2 width (ch2wid). it allows widths greater than 24 bits to be programmed and is added here to keep backwards compatibility with older versions of the pcm rw 0x0 14 ch2en channel 2 enable 0 = channel 2 disabled and no data is taken from the tx fifo and transmitted on channel 2. 1 = channel 2 enabled. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 134 ? 2012 broadcom corporation. all rights reserved 13:4 ch2pos channel 2 position this sets the bit clock at which the first bit (ms bit) of channel 2 data occurs in the frame. 0 indicates the first clock of frame. rw 0x0 3:0 ch2wid channel 2 width this sets the width of channel 2 in bit clocks. this field has been extended with the ch2wex bit giving a total width of (ch2wex* 16) + ch2wid + 8. the maximum supported width is 32 bits. 0 = 8 bits wide 1 = 9 bits wide rw 0x0 dreq_a register synopsis set the dma dreq and panic thresholds. the pcm drive s 2 dma controls back to the dma, one for the tx channel and one for the rx channe l. dma dreq is used to request the dma to perform another transfer, and dm a panic is used to tell the dma to use its panic level of priority when requesting t hins on the axi bus. this register cannot be changed whilst the pcm is running. bit(s) field name description type reset 31 reserved - write as 0, read as don't care 30:24 tx_panic tx panic level this sets the tx fifo panic level. when the level is below this the pcm will assert its tx dma panic signal. rw 0x10 23 reserved - write as 0, read as don't care 22:16 rx_panic rx panic level this sets the rx fifo panic level. when the level is above this the pcm will assert its rx dma panic signal. rw 0x30 15 reserved - write as 0, read as don't care 14:8 tx tx request level this sets the tx fifo dreq level. when the level is below this the pcm will assert its dma dreq signal to request more data is written to the tx fifo. rw 0x30 7 reserved - write as 0, read as don't care
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 135 ? 2012 broadcom corporation. all rights reserved 6:0 rx rx request level this sets the rx fifo dreq level. when the level is above this the pcm will assert its dma dreq signal to request that some more data is read out of the rx fifo. rw 0x20 inten_a register synopsis set the reasons for generating an interrupt. this r egister cannot be changed whilst the pcm is running. bit(s) field name description type reset 31:4 reserved - write as 0, read as don't care 3 rxerr rx error interrupt setting this bit enables interrupts from pcm block when rx fifo error occurs. rw 0x0 2 txerr tx error interrupt setting this bit enables interrupts from pcm block when tx fifo error occurs. rw 0x0 1 rxr rx read interrupt enable setting this bit enables interrupts from pcm block when rx fifo level is greater than or equal to the specified rxthr level. rw 0x0 0 txw tx write interrupt enable setting this bit enables interrupts from pcm block when tx fifo level is less than the specified txthr level. rw 0x0 intstc_a register synopsis this register is used to read and clear the pcm inte rrupt status. writing a 1 to the asserted bit clears the bit. writing a 0 has no effe ct. bit(s) field name description type reset 31:4 reserved - write as 0, read as don't care
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 136 ? 2012 broadcom corporation. all rights reserved 3 rxerr rx error interrupt status / clear this bit indicates an interrupt occurred on rx fifo error. writing 1 to this bit clears it. writing 0 has no effect. rw 0x0 2 txerr tx error interrupt status / clear this bit indicates an interrupt occurred on tx fifo error. writing 1 to this bit clears it. writing 0 has no effect. rw 0x0 1 rxr rx read interrupt status / clear this bit indicates an interrupt occurred on rx read. writing 1 to this bit clears it. writing 0 has no effect. rw 0x0 0 txw tx write interrupt status / clear this bit indicates an interrupt occurred on tx write. writing 1 to this bit clears it. writing 0 has no effect. rw 0x0 gray register synopsis this register is used to control the gray mode gener ation. this is used to put the pcm into a special data/strobe mode. this mode is under 'best effort ' contract. bit(s) field name description type reset 31:22 reserved - write as 0, read as don't care 21:16 rxfifolevel the current level of the rxfifo this indicates how many words are currently in the rxfifo. ro 0x0 15:10 flushed the number of bits that were flushed into the rxfifo this indicates how many bits were valid when the flush operation was performed. the valid bits are from bit 0 upwards. non-valid bits are set to zero. ro 0x0 9:4 rxlevel the current fill level of the rx buffer this indicates how many gray coded bits have been received. when 32 bits are received, they are written out into the rxfifo. ro 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 137 ? 2012 broadcom corporation. all rights reserved 3 reserved - write as 0, read as don't care 2 flush flush the rx buffer into the rx fifo this forces the rx buffer to do an early write. this is necessary if we have reached the end of the message and we have bits left in the rx buffer. flushing will write these bits as a single 32 bit word, starting at bit zero. empty bits will be packed with zeros. the number of bits written will be recorded in the flushed field. this bit is written as a 1 to initiate a flush. it will read back as a zero until the flush operation has completed (as the pcm clock may be very slow). rw 0x0 1 clr clear the gray mode logic this bit will reset all the gray mode logic, and flush the rx buffer. it is not self clearing. rw 0x0 0 en enable gray mode setting this bit will put the pcm into gray mode. in gray mode the data is received on the data in and the frame sync pins. the data is expected to be in data/strobe format. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 138 ? 2012 broadcom corporation. all rights reserved 9 pulse width modulator 9.1 overview this section specifies in detail the functionality provided by the device pulse width modulator (pwm) peripheral. the pwm controller incorporates the following features: ? two independent output bit-streams, clocked at a fixed frequen cy. ? bit-streams configured individually to output either pwm or a serialised version of a 32-bit word. ? pwm outputs have variable input and output resolutions. ? serialise mode configured to load data to and/or read data fro m a fifo storage block, which can store up to eight 32-bit words. ? both modes clocked by clk_pwm which is nominally 100mhz, but can be varied by the clock manager. 9.2 block diagram
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 139 ? 2012 broadcom corporation. all rights reserved 9.3 pwm implementation a value represented as a ratio of n/m can be transm itted along a serial channel with pulse width modulation in which the value is represented by the duty cycle of the output signal. to send value n/m within a periodic sequence of m cycles, output should be 1 for n cycles and 0 for (m-n) cycles. the desired sequence should have 1s and 0s spread out as even as possible so that during any arbitrary period of time duty cycle achieves closes t approximation of the value. this can be shown in the following table where 4/8 is modulated (n= 4, m = 8). bad 0 0 0 0 1 1 1 1 0 0 0 0 fair 0 0 1 1 0 0 1 1 0 0 1 1 good 0 1 0 1 0 1 0 1 0 1 0 1 sequence which gives the good approximation from the table above can be achieved by the following algorithm: where context is a register which stores the result of the addition/subtractions. 9.4 modes of operation pwm controller consists of two independent channels (pwm_chn in block diagram) which implement the pwm algorithm explained in section 1. 3. each channel can operate in either pwm mode or serialiser mode. pwm mode: there are two sub-modes in pwm mode: msen =0 and msen=1. when msen=0, which is the default mode, data to be sent is interpreted as the value n of the algorithm explained above. number of clock cycles ( range) used to send data is the value m of the algorithm. pulses are sent within this range so tha t the resulting duty cycle is n/m. channel sends it s output continuously as long as data register is use d, or buffer is used and it is not empty. 1. set context = 0 2. context = context + n 3. if (context >= m) context = context C m send 1 else
06 february 2012 broadcom europe ltd. 406 science p ark milton road cambridge cb4 0ww page 140 ? 2012 broadcom corporation. all rights reserved when msen=1, pwm block does not use the algorithm e xplained above, instead it sends serial data with the m/s ratio as in the picture below. m is th e data to be sent, and s is the range. this mode may be preferred if high frequency modulation is no t required or has negative effects. channel sends its output continuously as long as data regis ter is used, or buffer is used and it is not empty. serial bit transmission when m/s mode enabled serialiser mode: each channel is also capable of wo rking as a serialiser. in this mode data written in buffer or the data register is sent serially. 9.5 quick reference ? pwm dma is mapped to dma channel 5. ? gpios are assigned to pwm channels as below. please refer to gpio section for further details: pwm0 pwm1 gpio 12 alt fun 0 - gpio 13 - alt fun 0 gpio 18 alt fun 5 - gpio 19 - alt fun 5 gpio 40 alt fun 0 - gpio 41 - alt fun 0 gpio 45 - alt fun 0 gpio 52 alt fun 1 - gpio 53 - alt fun 1
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 141 ? 2012 broadcom corporation. all rights reserved ? pwm clock source and frequency is controlled in cprman. 9.6 control and status registers pwm address map address offset register name description size 0x0 ctl pwm control 32 0x4 sta pwm status 32 0x8 dmac pwm dma configuration 32 0x10 rng1 pwm channel 1 range 32 0x14 dat1 pwm channel 1 data 32 0x18 fif1 pwm fifo input 32 0x20 rng2 pwm channel 2 range 32 0x24 dat2 pwm channel 2 data 32 ctl register
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 142 ? 2012 broadcom corporation. all rights reserved synopsis pweni is used to enable/disable the corresponding cha nnel. setting this bit to 1 enables the channel and transmitter state machine. al l registers and fifo is writable without setting this bit. modei bit is used to determine mode of operation. s etting this bit to 0 enables pwm mode. in this mode data stored in either pwm_dati o r fifo is transmitted by pulse width modulation within the range defined by pwm_rng i. when this mode is used mseni defines whether to use pwm algorithm. setting modei to 1 enables serial mode, in which data stored in either pwm_dati or fif o is transmitted serially within the range defined by pwm_rngi. data is transmitted msb first and truncated or zero- padded depending on pwm_rngi. default mode is pwm. rptli is used to enable/disable repeating of the la st data available in the fifo just before it empties. when this bit is 1 and fifo is u sed, the last available data in the fifo is repeatedly sent. this may be useful in pwm m ode to avoid duty cycle gaps. if the fifo is not used this bit does not have any effe ct. default operation is do-not- repeat. sbiti defines the state of the output when no trans mission takes place. it also defines the zero polarity for the zero padding in serialiser m ode. this bit is padded between two consecutive transfers as well as tail of the data when pwm_rngi is larger than bit depth of data being transferred. this bit is zero by default. polai is used to configure the polarity of the outpu t bit. when set to high the final output is inverted. default operation is no inversi on. usefi bit is used to enable/disable fifo transfer. when this bit is high data stored in the fifo is used for transmission. when it is low, data written to pwm_dati is transferred. this bit is 0 as default. clrf is used to clear the fifo. writing a 1 to this bit clears the fifo. writing 0 has no effect. this is a single shot operation and reading the bit always returns 0. mseni is used to determine whether to use pwm algor ithm or simple m/s ratio transmission. when this bit is high m/s transmissio n is used. this bit is zero as default. when modei is 1, this configuration bit has no effec t. bit(s) field name description type reset 31:16 reserved - write as 0, read as don't care 15 msen2 channel 2 m/s enable 0: pwm algorithm is used 1: m/s transmission is used. rw 0x0 14 reserved - write as 0, read as don't care 13 usef2 channel 1 use fifo 0: data register is transmitted 1: fifo is used for transmission rw 0x0 12 pola2 channel 1 polarity 0 : 0=low 1=high 1: 1=low 0=high rw 0x0 11 sbit2 channel 1 silence bit defines the state of the output when no transmission takes place rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 143 ? 2012 broadcom corporation. all rights reserved 10 rptl2 channel 1 repeat last data 0: transmission interrupts when fifo is empty 1: last data in fifo is transmitted repetedly until fifo is not empty rw 0x0 9 mode2 channel 1 mode 0: pwm mode 1: serialiser mode rw 0x0 8 pwen2 channel 1 enable 0: channel is disabled 1: channel is enabled rw 0x0 7 msen1 channel 1 m/s enable 0: pwm algorithm is used 1: m/s transmission is used. rw 0x0 6 clrf1 clear fifo 1: clears fifo 0: has no effect this is a single shot operation. this bit always reads 0 ro 0x0 5 usef1 channel 1 use fifo 0: data register is transmitted 1: fifo is used for transmission rw 0x0 4 pola1 channel 1 polarity 0 : 0=low 1=high 1: 1=low 0=high rw 0x0 3 sbit1 channel 1 silence bit defines the state of the output when no transmission takes place rw 0x0 2 rptl1 channel 1 repeat last data 0: transmission interrupts when fifo is empty 1: last data in fifo is transmitted repetedly until fifo is not empty rw 0x0 1 mode1 channel 1 mode 0: pwm mode 1: serialiser mode rw 0x0 0 pwen1 channel 1 enable 0: channel is disabled 1: channel is enabled rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 144 ? 2012 broadcom corporation. all rights reserved sta register synopsis full1 bit indicates the full status of the fifo. if this bit is high fifo is full. empt1 bit indicates the empty status of the fifo. if this bit is high fifo is empty. werr1 bit sets to high when a write when full error occurs. software must clear this bit by writing 1. writing 0 to this bit has no effe ct. rerr1 bit sets to high when a read when empty error occurs. software must clear this bit by writing 1. writing 0 to this bit has no effe ct. gapoi. bit indicates that there has been a gap betwe en transmission of two consecutive data from fifo. this may happen when fifo gets empty after state machine has sent a word and waits for the next. if co ntrol bit rptli is set to high this event will not occur. software must clear this bit by writing 1. writing 0 to this bit has no effect. berr sets to high when an error has occurred while wr iting to registers via apb. this may happen if the bus tries to write successively to s ame set of registers faster than the synchroniser block can cope with. multiple switching m ay occur and contaminate the data during synchronisation. software should clear this bit by writing 1. writing 0 to this bit has no effect. stai bit indicates the current state of the channel wh ich is useful for debugging purposes. 0 means the channel is not currently transmi tting. 1 means channel is transmitting data. bit(s) field name description type reset 31:13 reserved - write as 0, read as don't care 12 sta4 channel 4 state rw 0x0 11 sta3 channel 3 state rw 0x0 10 sta2 channel 2 state rw 0x0 9 sta1 channel 1 state rw 0x0 8 berr bus error flag rw 0x0 7 gapo4 channel 4 gap occurred flag rw 0x0 6 gapo3 channel 3 gap occurred flag rw 0x0 5 gapo2 channel 2 gap occurred flag rw 0x0 4 gapo1 channel 1 gap occurred flag rw 0x0 3 rerr1 fifo read error flag rw 0x0 2 werr1 fifo write error flag rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 145 ? 2012 broadcom corporation. all rights reserved 1 empt1 fifo empty flag rw 0x1 0 full1 fifo full flag rw 0x0 dmac register synopsis enab bit is used to start dma. panic bits are used to determine the threshold leve l for panic signal going active. default value is 7. dreq bits are used to determine the threshold level for dreq signal going active. default value is 7. bit(s) field name description type reset 31 enab dma enable 0: dma disabled 1: dma enabled rw 0x0 30:16 reserved - write as 0, read as don't care 15:8 panic dma threshold for panic signal rw 0x7 7:0 dreq dma threshold for dreq signal rw 0x7 rng1 register synopsis this register is used to define the range for the co rresponding channel. in pwm mode evenly distributed pulses are sent within a period of length defined by this register. in serial mode serialised data is transmitted within t he same period. if the value in pwm_rngi is less than 32, only the first pwm_rngi bi ts are sent resulting in a truncation. if it is larger than 32 excess zero bits ar e padded at the end of data. default value for this register is 32. note: channels 3 and 4 are not available in b0 and corresponding channel range registers are ignored. bit(s) field name description type reset 31:0 pwm_rngi channel i range rw 0x20
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 146 ? 2012 broadcom corporation. all rights reserved dat1 register synopsis this register stores the 32 bit data to be sent by t he pwm controller when usefi is 0. in pwm mode data is sent by pulse width modulation: the value of this register defines the number of pulses which is sent within the period defined by pwm_rngi. in serialiser mode data stored in this register is ser ialised and transmitted. note: channels 3 and 4 are not available in b0 and corresponding channel data registers are ignored. bit(s) field name description type reset 31:0 pwm_dati channel i data rw 0x0 fif1 register synopsis this register is the fifo input for the all channels . data written to this address is stored in channel fifo and if usefi is enabled for t he channel i it is used as data to be sent. this register is write only, and reading th is register will always return bus default return value, pwm0 . when more than one channel is enabled for fifo usage , the data written into the fifo is shared between these channels in turn. for example if the word series a b c d e f g h i .. is written to fifo and two channels are acti ve and configured to use fifo then channel 1 will transmit words a c e g i .. and channe l 2 will transmit words b d f h .. . note that requesting data from the fifo is in locked- step manner and therefore requires tight coupling of state machines of the chann els. if any of the channel range (period) value is different than the others this wi ll cause the channels with small range values to wait between words hence resulting in gaps between words. to avoid that, each channel sharing the fifo should be configured to use the same range value. also note that rptli are not meaningful when the fi fo is shared between channels as there is no defined channel to own the last data in the fifo. therefore sharing channels must have their rptli set to zero. if the set of channels to share the fifo has been mo dified after a configuration change, fifo should be cleared before writing new dat a. bit(s) field name description type reset 31:0 pwm_fifo channel fifo input rw 0x0 rng2 register
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 147 ? 2012 broadcom corporation. all rights reserved synopsis this register is used to define the range for the co rresponding channel. in pwm mode evenly distributed pulses are sent within a period of length defined by this register. in serial mode serialised data is transmitted within t he same period. if the value in pwm_rngi is less than 32, only the first pwm_rngi bi ts are sent resulting in a truncation. if it is larger than 32 excess zero bits ar e padded at the end of data. default value for this register is 32. note: channels 3 and 4 are not available in b0 and corresponding channel range registers are ignored. bit(s) field name description type reset 31:0 pwm_rngi channel i range rw 0x20 dat2 register synopsis this register stores the 32 bit data to be sent by t he pwm controller when usefi is 1. in pwm mode data is sent by pulse width modulation: the value of this register defines the number of pulses which is sent within the period defined by pwm_rngi. in serialiser mode data stored in this register is ser ialised and transmitted. note: channels 3 and 4 are not available in b0 and corresponding channel data registers are ignored. bit(s) field name description type reset 31:0 pwm_dati channel i data rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 148 ? 2012 broadcom corporation. all rights reserved 10 spi 10.1 introduction this serial interface peripheral supports the following fe atures: ? implements a 3 wire serial protocol, variously called s erial peripheral interface (spi) or synchronous serial protocol (ssp). ? implements a 2 wire version of spi that uses a single wire as a bidirectional data wire instead of one for each direction as in standard spi. ? implements a lossi master (low speed serial interface ) ? provides support for polled, interrupt or dma operation. 10.2 spi master mode 10.2.1 standard mode in standard spi master mode the peripheral implements t he standard 3 wire serial protocol described below. figure 10-1 spi master typical usage
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 149 ? 2012 broadcom corporation. all rights reserved figure 10-2 spi cycle figure 10-3 different clock polarity/phase 10.2.2 bidirectional mode in bidirectional spi master mode the same spi standard is implemented except that a single wire is used for the data (mimo) instead of the two as in standard mode (miso and mosi). bidirectional mode is used in a similar way to standar d mode, the only difference is that before attempting to read data from the slave, you must set the read enable (spi_ren) bit in the spi control and status register (spi_cs). this will turn the bus around, and when you write to the spi_fifo register (with junk) a read tran saction will take place on the bus, and the read data will appear in the fifo. figure 10-4 bidirectional spi master typical usage
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 150 ? 2012 broadcom corporation. all rights reserved 10.3 lossi mode figure 10-5 lossi mode typical usage the lossi standard allows us to issue commands to p eripherals and to transfer data to and from them. lossi commands and parameters are 8 bits long , but an extra bit is used to indicate whether the byte is a command or data. this extra bit is se t high for a parameter and low for a command. the resulting 9-bit value is serialized to the output. when reading from a lossi peripheral the standard allows us to read bytes of data, as well as 24 and 32 bit words. commands and parameters are issued to a lossi perip heral by writing the 9-bit value of the command or data into the spi_fifo register as you w ould for spi mode. reads are automated in that if the serial interface peripheral detects a read c ommand being issued, it will issue the command and complete the read transaction, putting the received data into the fifo. 10.3.1 command write 10.3.2 parameter write
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 151 ? 2012 broadcom corporation. all rights reserved 10.3.3 byte read commands byte read commands are 0x0a, 0x0b, 0x0c, 0x0d, 0x0e , 0x0f, 0xda, 0xdb, 0xdc. 10.3.4 24bit read command a 24 bit read can be achieved by using the command 0x04. 10.3.5 32bit read command a 32bit read can be achieved by using the command 0x09.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 152 ? 2012 broadcom corporation. all rights reserved 10.4 block diagram figure 10-6 serial interface block diagram 10.5 spi register map the BCM2835 devices has only one spi interface of this type. it is referred to in all the documentation as spi0. it has two additional mini spi i nterfaces (spi1 and spi2). the specifiation of those can be found under 2.3 universal spi master (2x) . the base address of this spi0 interface is 0x7e204000. spi address map address offset register name description size 0x0 cs spi master control and status 32 0x4 fifo spi master tx and rx fifos 32 0x8 clk spi master clock divider 32
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 153 ? 2012 broadcom corporation. all rights reserved 0xc dlen spi master data length 32 0x10 ltoh spi lossi mode toh 32 0x14 dc spi dma dreq controls 32 cs register synopsis this register contains the main control and status bi ts for the spi. bit(s) field name description type reset 31:26 reserved - write as 0, read as don't care 25 len_long enable long data word in lossi mode if dma_len is set 0= writing to the fifo will write a single byte 1= wrirng to the fifo will write a 32 bit word rw 0x0 24 dma_len enable dma mode in lossi mode rw 0x0 23 cspol2 chip select 2 polarity 0= chip select is active low. 1= chip select is active high. rw 0x0 22 cspol1 chip select 1 polarity 0= chip select is active low. 1= chip select is active high. rw 0x0 21 cspol0 chip select 0 polarity 0= chip select is active low. 1= chip select is active high. rw 0x0 20 rxf rxf - rx fifo full 0 = rxfifo is not full. 1 = rx fifo is full. no further serial data will be sent/ received until data is read from fifo. ro 0x0 19 rxr rxr rx fifo needs reading ( full) 0 = rx fifo is less than full (or not active ta = 0). 1 = rx fifo is or more full. cleared by reading sufficient data from the rx fifo or setting ta to 0. ro 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 154 ? 2012 broadcom corporation. all rights reserved 18 txd txd tx fifo can accept data 0 = tx fifo is full and so cannot accept more data. 1 = tx fifo has space for at least 1 byte. ro 0x1 17 rxd rxd rx fifo contains data 0 = rx fifo is empty. 1 = rx fifo contains at least 1 byte. ro 0x0 16 done done transfer done 0 = transfer is in progress (or not active ta = 0). 1 = transfer is complete. cleared by writing more data to the tx fifo or setting ta to 0. ro 0x0 15 te_en unused rw 0x0 14 lmono unused rw 0x0 13 len len lossi enable the serial interface is configured as a lossi master. 0 = the serial interface will behave as an spi master. 1 = the serial interface will behave as a lossi master. rw 0x0 12 ren ren read enable read enable if you are using bidirectional mode. if this bit is set, the spi peripheral will be able to send data to this device. 0 = we intend to write to the spi peripheral. 1 = we intend to read from the spi peripheral. rw 0x1 11 adcs adcs automatically deassert chip select 0 = don t automatically deassert chip select at the end of a dma transfer chip select is manually controlled by software. 1 = automatically deassert chip select at the end of a dma transfer (as determined by spidlen) rw 0x0 10 intr intr interrupt on rxr 0 = don t generate interrupts on rx fifo condition. 1 = generate interrupt while rxr = 1. rw 0x0 9 intd intd interrupt on done 0 = don t generate interrupt on transfer complete. 1 = generate interrupt when done = 1. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 155 ? 2012 broadcom corporation. all rights reserved 8 dmaen dmaen dma enable 0 = no dma requests will be issued. 1 = enable dma operation. peripheral generates data requests. these will be taken in four-byte words until the spidlen has been reached. rw 0x0 7 ta transfer active 0 = transfer not active./cs lines are all high (assuming cspol = 0). rxr and done are 0. writes to spififo write data into bits -0 of spics allowing dma data blocks to set mode before sending data. 1 = transfer active. /cs lines are set according to cs bits and cspol. writes to spififo write data to tx fifo.ta is cleared by a dma_frame_end pulse from the dma controller. rw 0x0 6 cspol chip select polarity 0 = chip select lines are active low 1 = chip select lines are active high rw 0x0 5:4 clear clear fifo clear 00 = no action. x1 = clear tx fifo. one shot operation. 1x = clear rx fifo. one shot operation. if clear and ta are both set in the same operation, the fifos are cleared before the new frame is started. read back as 0. rw 0x0 3 cpol clock polarity 0 = rest state of clock = low. 1 = rest state of clock = high. rw 0x0 2 cpha clock phase 0 = first sclk transition at middle of data bit. 1 = first sclk transition at beginning of data bit. rw 0x0 1:0 cs chip select 00 = chip select 0 01 = chip select 1 10 = chip select 2 11 = reserved rw 0x0 fifo register synopsis this register allows tx data to be written to the t x fifo and rx data to be read from the rx fifo.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 156 ? 2012 broadcom corporation. all rights reserved bit(s) field name description type reset 31:0 data dma mode (dmaen set) if ta is clear, the first 32-bit write to this regi ster will control spidlen and spics. subsequent reads and writes will be taken as four-byte data words to be read/written to the fifos poll/interrupt mode (dmaen clear, ta set) writes to the register write bytes to tx fifo. reads from register read bytes from the rx fifo rw 0x0 clk register synopsis this register allows the spi clock rate to be set. bit(s) field name description type reset 31:16 reserved - write as 0, read as don't care 15:0 cdiv clock divider sclk = core clock / cdiv if cdiv is set to 0, the divisor is 65536. the divisor must be a power of 2. odd numbers rounded down. the maximum spi clock rate is of the apb clock. rw 0x0 dlen register synopsis this register allows the spi data length rate to be set. bit(s) field name description type reset 31:16 reserved - write as 0, read as don't care 15:0 len data length the number of bytes to transfer. this field is only valid for dma mode (dmaen set) and controls how many bytes to transmit (and therefore receive). rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 157 ? 2012 broadcom corporation. all rights reserved ltoh register synopsis this register allows the lossi output hold delay to be set. bit(s) field name description type reset 31:4 reserved - write as 0, read as don't care 3:0 toh this sets the output hold delay in apb clocks. a value of 0 causes a 1 clock delay. rw 0x1 dc register synopsis this register controls the generation of the dreq an d panic signals to an external dma engine the dreq signals are generated when the fifos reach their defined levels and need servicing. the panic signals instru ct the external dma engine to raise the priority of its axi requests. bit(s) field name description type reset 31:24 rpanic dma read panic threshold. generate the panic signal to the rx dma engine whenever the rx fifo level is greater than this amount. rw 0x30 23:16 rdreq dma read request threshold. generate a dreq to the rx dma engine whenever the rx fifo level is greater than this amount, (rx dreq is also generated if the transfer has finished but the rxfifo isn t empty). rw 0x20 15:8 tpanic dma write panic threshold. generate the panic signal to the tx dma engine whenever the tx fifo level is less than or equal to this amount. rw 0x10 7:0 tdreq dma write request threshold. generate a dreq signal to the tx dma engine whenever the tx fifo level is less than or equal to this amount. rw 0x20
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 158 ? 2012 broadcom corporation. all rights reserved 10.6 software operation 10.6.1 polled a) set cs, cpol, cpha as required and set ta = 1. b) poll txd writing bytes to spi_fifo, rxd reading bytes from spi_fifo until all data written. c) poll done until it goes to 1. d) set ta = 0. 10.6.2 interrupt e) set intr and intd. these can be left set over multip le operations. f) set cs, cpol, cpha as required and set ta = 1. this wil l immediately trigger a first interrupt with done == 1. g) on interrupt: h) if done is set and data to write (this means it is th e first interrupt), write up to 16 bytes to spi_fifo. if done is set and no more data, set ta = 0. read trailing data from spi_fifo until rxd is 0. i) if rxr is set read 12 bytes data from spi_fifo and if mor e data to write, write up to 12 bytes to spififo. 10.6.3 dma note: in order to function correctly, each dma channel must be set to perform 32-bit transfers when communicating with the spi. either the source or the destination transfer width field in the dma ti register must be set to 0 (i.e . 32-bit words) depending upon whether the channel is reading or writing to the spi. two dma channels are required, one to read from and one to write to the spi. j) enable dma dreq?s by setting the dmaen bit and adcs if r equired. k) program two dma control blocks, one for each dma contr oller. l) dma channel 1 control block should have its per_map set to x and should be set to write ?transfer length? + 1 words to spi_fifo. the data s hould comprise: i) a word with the transfer length in bytes in the top si xteen bits, and the control register settings [7:0] in the bottom eight bits (i.e. ta = 1, cs, cpol, cpha as required.) ii) ?transfer length? number in words of data to send. m) dma channel 2 control block should have its per_map set to y and should be set to read ?transfer length? words from spi_fifo. n) point each dma channel at its cb and set its active bit to 1. o) on receipt of an interrupt from dma channel 2, the trans fer is complete.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 159 ? 2012 broadcom corporation. all rights reserved 10.6.4 notes 1. the spi master knows nothing of the peripherals it is con nected to. it always both sends and receives bytes for every byte of the transacti on. 2. sclk is only generated during byte serial transfer. it paus es in the rest state if the next byte to send is not ready or rxf is set. 3. setup and hold times related to the automatic asser tion and de-assertion of the cs lines when operating in dma mode (dmaen and adcs set) are as follows: the cs line will be asserted at least 3 core clock cycles before the msb of the first byte of the transfer. the cs line will be de-asserted no earlier than 1 c ore clock cycle after the trailing edge of the final clock pulse. if these parameters are insufficient, software cont rol should alleviate the problem. adcs should be 0 allowing software to manually control t he assertion and de-assertion of the cs lines.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 160 ? 2012 broadcom corporation. all rights reserved 11 spi/bsc slave 11.1 introduction the bsc interface can be used as either a broadcom ser ial controller (bsc) or a serial peripheral interface (spi) controller. the bsc bus is a proprietary bus compliant with the philips? i2c bus/interface version 2.1 january 2000. both bsc a nd spi controllers work in the slave mode. the bsc slave controller has speciall y built in the host control and software registers for a chip booting. the bcs controller supports fast-mode (400kb/s) and it is compliant to the i 2 c bus specification version 2.1 january 2000 with the restric tions: ? i 2 c slave only operation ? clock stretching is not supported ? 7-bit addressing only ? there is only one bsc/spi slave. the registers base addresses is 0x7e21_4000. 11.2 registers the spi controller implements 3 wire serial protocol variously called serial peripheral interface (spi) or synchronous serial protocol (ssp). bsc and spi controllers do not have dma connected, hence dma is not supported. i2c_spi_slv address map address offset register name description size 0x0 dr data register 32 0x4 rsr the operation status register and error clear regist er 32 0x8 slv the i2c spi address register holds the i2c slave address value 32 0xc cr the control register is used to configure the i2c or spi operation 32 0x10 fr flag register 32 0x14 ifls interrupt fifo level select register 32 0x18 imsc interupt mask set clear register 32
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 161 ? 2012 broadcom corporation. all rights reserved 0x1c ris raw interupt status register 32 0x20 mis masked interupt status register 32 0x24 icr interupt clear register 32 0x28 dmacr dma control register 32 0x2c tdr fifo test data 32 0x30 gpustat gpu status register 32 0x34 hctrl host control register 32 0x38 debug1 i2c debug register 32 0x3c debug2 spi debug register 32 dr register synopsis the i2c spi data register is used to transfer/receiv e data characters and provide a status and flag information. status and flag inform ation is also available via individual registers. bit(s) field name description type reset 31:27 rxflevel rxflevel rx fifo level returns the current level of the rx fifo use ro 0x0 26:22 txflevel txflevel tx fifo level returns the current level of the tx fifo use ro 0x0 21 rxbusy rxbusy receive busy 0 receive operation inactive 1 receive operation in operation ro 0x0 20 txfe txfe tx fifo empty 0 tx fifo is not empty 1 when tx fifo is empty ro 0x1 19 rxff rxfe rx fifo full 0 fx fifo is not full 1 when fx fifo is full ro 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 162 ? 2012 broadcom corporation. all rights reserved 18 txff txff tx fifo full 0 tx fifo is not full 1 when tx fifo is full ro 0x0 17 rxfe rxfe rx fifo empty 0 fx fifo is not empty 1 when fx fifo is empty ro 0x1 16 txbusy txbusy transmit busy 0 transmit operation inactive 1 transmit operation in operation ro 0x0 15:10 reserved - write as 0, read as don't care 9 ue txue tx underrun error 0 - no error case detected 1 set when tx fifo is empty and i2c master attempt to read a data character from i2c slave. cleared by writing 0 to i2c spi status register . ro 0x0 8 oe rxoe rx overrun error 0 no error case detected 1 set when rx fifo is full and a new data character is received. cleared by writing 0 to i2c spi status register . ro 0x0 7:0 data data received/transferred data characters data written to this location is pushed into the tx fifo. data read from this location is fetched from the rx fifo. rw 0x0 rsr register synopsis the operation status register and error clear regist er. bit(s) field name description type reset 31:6 reserved - write as 0, read as don't care 5 rxdmabreq unsupported, write zero, read as don't care ro 0x0 4 rxdmapreq unsupported, write zero, read as don't care ro 0x0 3 txdmabreq unsupported, write zero, read as don't care ro 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 163 ? 2012 broadcom corporation. all rights reserved 2 txdmapreq unsupported, write zero, read as don't care ro 0x0 1 ue txue tx underrun error 0 - no error case detected 1 set when tx fifo is empty and i2c master attempt to read a data character from i2c slave. cleared by writing 0 to it. rw 0x0 0 oe rxoe rx overrun error 0 no error case detected 1 set when rx fifo is full and a new data character is received. cleared by writing 0 to it. rw 0x0 slv register synopsis the i2c spi address register holds the i2c slave ad dress value. note: it is of no use in spi mode. bit(s) field name description type reset 31:7 reserved - write as 0, read as don't care 6:0 addr slvaddr i2c slave address programmable i2c slave address note: in case hostctrlen bit is set from the i2c spi control register bit slvaddr[0] chooses the following: 0 - selects normal operation, i.e. accessing rx and tx fifos. 1 - selects access to i2c spi sw status register or i2c spi host control register rw 0x0 cr register synopsis the control register is used to configure the i2c or spi operation. bit(s) field name description type reset 31:14 reserved - write as 0, read as don't care
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 164 ? 2012 broadcom corporation. all rights reserved 13 inv_txf inv-rx inverse tx status flags 0 = default status flags when this bit is 0, bit 6 (txfe - tx fifo empty) will reset to a 1 1 = inverted status flags when this bit is set, bit 6 (txfe - tx fifo full) will reset to a 0 * note: inv_tx bit changes the default values of 6 bit as it is specified for i2c spi gpu host status register . rw 0x0 12 hostctrlen hostctrlen enable control for host 0 = host control disabled 1 = host control enabled note: hostctrlen allows host to request gpustat or hctrl register. the same behaviour is achieved from the gpu side using enstat and enctrl. rw 0x0 11 testfifo testfifo test fifo 0 = testt fifo disabled 1 = testt fifo enabled rw 0x0 10 inv_rxf inv-rx inverse rx status flags 0 = default status flags when this bit is 0, bit 6 (rxff - rx fifo full) will reset to a 0 1 = inverted status flags when this bit is 0, bit 6 (rxff - rx fifo empty) will reset to a 1 * note: inv_rx bit changes the default values of 7 bit as it is specified for i2c spi gpu host status register . rw 0x0 9 rxe rxe receive enable 0 = receive mode disabled 1 = receive mode enabled rw 0x0 8 txe txe transmit enable 0 = transmit mode disabled 1 = transmit mode enabled rw 0x0 7 brk brk break current operation 0 = no effect. 1 = stop operation and clear the fifos. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 165 ? 2012 broadcom corporation. all rights reserved 6 enctrl enctrl enable control 8bit register 0 = control register disabled. implies ordinary i2c protocol. 1 = control register enabled. when enabled the control register is received as a first data character on the i2c bus. note: the same behaviour is achieved from the host side by using bit slvaddr[6] of the slave address. ro 0x0 5 enstat enstat enable status 8bit register 0 = status register disabled. implies ordinary i2c protocol. 1 = status register enabled. when enabled the status register is transferred as a first data character on the i2c bus. status register is transferred to the host. note: the same behaviour is achieved from the host side by using bit slvaddr[6] of the slave address. rw 0x0 4 cpol cpol clock polarity 0 = 1 = spi related rw 0x0 3 cpha cpha clock phase 0 = 1 = spi related rw 0x0 2 i2c spi mode 0 = disabled i2c mode 1 = enabled i2c mode rw 0x0 1 spi spi mode 0 = disabled spi mode 1 = enabled spi mode rw 0x0 0 en en enable device 1 = enable i2c spi slave. 0 = disable i2c spi slave. rw 0x0 fr register synopsis the flag register indicates the current status of the operation. bit(s) field name description type reset 31:16 reserved - write as 0, read as don't care
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 166 ? 2012 broadcom corporation. all rights reserved 15:11 rxflevel rxflevel rx fifo level returns the current level of the rx fifo use rw 0x0 10:6 txflevel txflevel tx fifo level returns the current level of the tx fifo use rw 0x0 5 rxbusy rxbusy receive busy 0 receive operation inactive 1 receive operation in operation rw 0x0 4 txfe txfe tx fifo empty 0 tx fifo is not empty 1 when tx fifo is empty rw 0x1 3 rxff rxfe rx fifo full 0 fx fifo is not full 1 when fx fifo is full rw 0x0 2 txff txff tx fifo full 0 tx fifo is not full 1 when tx fifo is full rw 0x0 1 rxfe rxfe rx fifo empty 0 fx fifo is not empty 1 when fx fifo is empty rw 0x1 0 txbusy txbusy transmit busy 0 transmit operation inactive 1 transmit operation in operation rw 0x0 ifls register synopsis the flag register indicates the current status of the operation. bit(s) field name description type reset 31:12 reserved - write as 0, read as don't care 11:9 rxifpsel unsupported, write zero, read as don't care ro 0x0 8:6 txifpsel unsupported, write zero, read as don't care ro 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 167 ? 2012 broadcom corporation. all rights reserved 5:3 rxiflsel rxiflsel rx interrupt fifo level select interrupt is triggered when : 000 rx fifo gets 1/8 full 001 rx fifo gets 1/4 full 010 rx fifo gets 1/2 full 011 rx fifo gets 3/4 full 100 rx fifo gets 7/8 full 101 111 not used rw 0x0 2:0 txiflsel txiflsel tx interrupt fifo level select interrupt is triggered when : 000 tx fifo gets 1/8 full 001 tx fifo gets 1/4 full 010 tx fifo gets 1/2 full 011 tx fifo gets 3/4 full 100 tx fifo gets 7/8 full 101 111 not used rw 0x0 imsc register synopsis interrupt mask set/clear register. on a read this re gister returns the current value of the mask on the relevant interrupt. on a write of 1 to the particular bit, it sets the corresponding mask of that interrupt. a write of 0 cl ears the corresponding mask. bit(s) field name description type reset 31:4 reserved - write as 0, read as don't care 3 oeim overrun error interrupt mask. a read returns the current mask for the interrupt. on a write of 1, the mask of the oeintr interrupt is set. a write of 0 clears the mask. rw 0x0 2 beim break error interrupt mask. a read returns the current mask for the beintr interrupt. on a write of 1, the mask of the interrupt is set. a writ e of 0 clears the mask. rw 0x0 1 txim transmit interrupt mask. a read returns the current mask for the txintr interrupt. on a write of 1, the mask of the interrupt is set. a writ e of 0 clears the mask. rw 0x0 0 rxim receive interrupt mask. a read returns the current mask for the rxintr interrupt. on a write of 1, the mask of the interrupt is set. a writ e of 0 clears the mask. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 168 ? 2012 broadcom corporation. all rights reserved ris register synopsis the raw interrupt status register returns the curren t raw status value, prior to masking, of the corresponding interrupt. bit(s) field name description type reset 31:4 reserved - write as 0, read as don't care 3 oeris overrun error interrupt status. returns the raw interrupt state of the oeintr interrupt. rw 0x0 2 beris break error interrupt status. returns the raw interrupt state of the beintr interrupt. rw 0x0 1 txris transmit interrupt status. returns the raw interrupt state of the txintr interrupt. rw 0x0 0 rxris receive interrupt status. returns the raw interrupt state of the rxintr interrupt. rw 0x0 mis register synopsis the masked interrupt status register returns the curr ent masked status value of the corresponding interrupt. bit(s) field name description type reset 31:4 reserved - write as 0, read as don't care 3 oemis overrun error masked interrupt status. returns the masked interrupt state of the oeintr interrupt. rw 0x0 2 bemis break error masked interrupt status. returns the masked interrupt state of the beintr interrupt. rw 0x0 1 txmis transmit masked interrupt status. returns the masked interrupt state of the txintr interrupt. rw 0x0 0 rxmis receive masked interrupt status. returns the masked interrupt state of the rxintr interrupt. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 169 ? 2012 broadcom corporation. all rights reserved icr register synopsis the interrupt clear register. bit(s) field name description type reset 31:4 reserved - write as 0, read as don't care 3 oeic overrun error interrupt clear. clears the oeintr interrupt. rw 0x0 2 beic break error interrupt clear. clears the beintr interrupt. rw 0x0 1 txic transmit interrupt clear. clears the txintr interrupt. rw 0x0 0 rxic receive masked interrupt status. returns the masked interrupt state of the rxintr interrupt. rw 0x0 dmacr register synopsis the dma control register is not supported in this v ersion. bit(s) field name description type reset 31:3 reserved - write as 0, read as don't care 2 dmaonerr unsupported, write zero, read as don't care rw 0x0 1 txdmae unsupported, write zero, read as don't care rw 0x0 0 rxdmae unsupported, write zero, read as don't care rw 0x0 tdr register synopsis the test data register enables data to be written i nto the receive fifo and read out from the transmit fifo for test purposes.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 170 ? 2012 broadcom corporation. all rights reserved bit(s) field name description type reset 31:8 reserved - write as 0, read as don't care 7:0 data test data is written into the receive fifo and read out of the transmit fifo. rw 0x0 gpustat register synopsis the gpu sw status register to be passed via i2c bus to a host. note: gpu sw status register is combined with the st atus bit coming from within i2c spi slave device. hence, the i2c spi gpu host sta tus register as it is seen by a host is depicted on table 1 14. bit(s) field name description type reset 31:4 reserved - write as 0, read as don't care 3:0 data gpustat gpu to host status register sw controllable rw 0x0 hctrl register synopsis the host control register is received from the host side via i2c bus. when enctrl - enable control register bit is set, the host control register is received as the first data character after the i2c address. bit(s) field name description type reset 31:8 reserved - write as 0, read as don't care 7:0 data hctrl host control register sw processing received via i2c bus rw 0x0 debug1 register synopsis i2c debug register
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 171 ? 2012 broadcom corporation. all rights reserved bit(s) field name description type reset 31:26 reserved - write as 0, read as don't care 25:0 data rw 0xe debug2 register synopsis spi debug register bit(s) field name description type reset 31:24 reserved - write as 0, read as don't care 23:0 data rw 0x400000
r eference : c6357-m-1398 b roadcom p roprietary and c onfidential p age 172 ? 2012 broadcom corporation. all rights reserved broadcom europe ltd. 406 science park milton road cambridge cb4 0ww 12 system timer the system timer peripheral provides four 32-bit timer channe ls and a single 64-bit free running counter. each channel has an output compare register, whi ch is compared against the 32 least significant bits of the free running counter values. when t he two values match, the system timer peripheral generates a signal to indicate a match for the appropriate channel. the match signal is then fed into the interrupt controller. the interrupt servi ce routine then reads the output compare register and adds the appropriate offset for the next timer tick. the free running counter is driven by the timer clock and stopped whenever the processor is stopped in debug mode. the physical (hardware) base address for the system tim ers is 0x7e003000. 12.1 system timer registers st address map address offset register name description size 0x0 cs system timer control/status 32 0x4 clo system timer counter lower 32 bits 32 0x8 chi system timer counter higher 32 bits 32 0xc c0 system timer compare 0 32 0x10 c1 system timer compare 1 32 0x14 c2 system timer compare 2 32 0x18 c3 system timer compare 3 32 cs register synopsis system timer control / status. this register is used to record and clear timer cha nnel comparator matches. the system timer match bit s are routed to the interrupt controller where they c an generate an interrupt. the m0-3 fields contain the free-running counter ma tch status. write a one to the relevant bit to clea r the match detect status bit and the corresponding inter rupt request line.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 173 ? 2012 broadcom corporation. all rights reserved bit(s) field name description type reset 31:4 reserved - write as 0, read as don't care 3 m3 system timer match 3 0 = no timer 3 match since last cleared. 1 = timer 3 match detected. rw 0x0 2 m2 system timer match 2 0 = no timer 2 match since last cleared. 1 = timer 2 match detected. rw 0x0 1 m1 system timer match 1 0 = no timer 1 match since last cleared. 1 = timer 1 match detected. rw 0x0 0 m0 system timer match 0 0 = no timer 0 match since last cleared. 1 = timer 0 match detected. rw 0x0 clo register synopsis system timer counter lower bits. the system timer free-running counter lower registe r is a read-only register that returns the current value of the lower 32-bits of the free running counter. bit(s) field name description type reset 31:0 cnt lower 32 - bits of the free running counter value. rw 0x0 chi register synopsis system timer counter higher bits. the system timer free-running counter higher regist er is a read-only register that returns the current value of the higher 32-bits of the free running counter. bit(s) field name description type reset 31:0 cnt higher 32 - bits of the free running counter value. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 174 ? 2012 broadcom corporation. all rights reserved c0 c1 c2 c3 register synopsis system timer compare. the system timer compare registers hold the compare value for each of the four timer channels. whenever the lower 32-bits of the free-running coun ter matches one of the compare values the corresponding bit in the system timer control/statu s register is set. each timer peripheral (minirun and run) has a set o f four compare registers. bit(s) field name description type reset 31:0 cmp compare value for match channel n. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 175 ? 2012 broadcom corporation. all rights reserved 13 uart the BCM2835 device has two uarts. on mini uart and and pl011 u art. this section describes the pl011 uart. for details of the mini uart see 2.2 mini uart . the pl011 uart is a universal asynchronous receiver/transmi tter. this is the arm uart (pl011) implementation. the uart performs serial-to -parallel conversion on data characters received from an external peripheral device o r modem, and parallel-to-serial conversion on data characters received from the advanc ed peripheral bus (apb). the arm pl011 uart has some optional functionality whic h can be included or left out. the following functionality is not supported : infrared data association (irda) serial infrared (sir) protocol encoder/decoder (endec) direct memory access (dma). the uart provides: ? separate 16x8 transmit and 16x12 receive fifo memory. ? programmable baud rate generator. ? standard asynchronous communication bits (start, stop and parity). these are added prior to transmission and removed on reception. ? false start bit detection. ? line break generation and detection. ? support of the modem control functions cts and rts. howe ver dcd, dsr, dtr, and ri are not supported. ? programmable hardware flow control. ? fully-programmable serial interface characteristics: data can be 5, 6, 7, or 8 bits even, odd, stick, or no-parity bit generation and detection 1 or 2 stop bit generation baud rate generation, dc up to uartclk/16 the uart clock source and associated dividers are controll ed by the clock manager. for the in-depth uart overview, please, refer to the ar m primecell uart (pl011) revision: r1p5 technical reference manual. 13.1 variations from the 16c650 uart the uart varies from the industry-standard 16c650 uart device as follows: ? receive fifo trigger levels are 1/8, 1/4, 1/2, 3/4, and 7/8 ? transmit fifo trigger levels are 1/8, 1/4, 1/2, 3/4, and 7/8 ? the internal register map address space, and the bit func tion of each register differ
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 176 ? 2012 broadcom corporation. all rights reserved ? the deltas of the modem status signals are not availabl e. the following 16c650 uart features are not supported: ? 1.5 stop bits (1 or 2 stop bits only are supported) ? independent receive clock. 13.2 primary uart inputs and outputs the uart has two primary inputs rxd, ncts and two primary outputs txd, nrts. the remaining signals like srin, srout, out1, out2, dsr, d tr, and ri are not supported in this implementation. the following table shows the uart signals map on the general purpose i/o (gpio). for the insight on how to program a lternate function refer to the gpio paragraph. pull alt0 alt1 alt2 alt3 alt4 alt5 gpio14 low txd0 gpio15 low rxd0 gpio16 low cts0 gpio17 low rts0 gpio30 low cts0 gpio31 low rts0 gpio32 low txd0 gpio33 low rxd0 gpio36 high txd0 gpio37 low rxd0 gpio38 low rts0 gpio39 low cts0 table 13-1 uart assignment on the gpio pin map 13.3 uart interrupts the uart has one intra-chip interrupt uartintr generated as the or-ed function of the five individual interrupts. ? uartintr, this is an or function of the five indivi dual masked outputs: ? uartrxintr ? uarttxintr ? uartrtintr ? uartmsintr, that can be caused by: ? uartctsintr, because of a change in the nuartcts modem status ? uartdsrintr, because of a change in the nuartdsr mode m status. ? uarteintr, that can be caused by an error in the rec eption:
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 177 ? 2012 broadcom corporation. all rights reserved ? uartoeintr, because of an overrun error ? uartbeintr, because of a break in the reception ? uartpeintr, because of a parity error in the received character ? uartfeintr, because of a framing error in the receive d character. one can enable or disable the individual interrupts by chang ing the mask bits in the interrupt mask set/clear register, uart_imsc. setting the appropria te mask bit high enables the interrupt. uartrxintr: the transmit interrupt changes state when one of the f ollowing events occurs: ? if the fifos are enabled and the transmit fifo is equ al to or lower than the programmed trigger level then the transmit interrupt is asserted high. the transmit interrupt is cleared by writing data to the transmit fifo until it becomes greater than the trigger level, or by clearing the interrupt. ? if the fifos are disabled (have a depth of one locatio n) and there is no data present in the transmitters single location, the transmit inte rrupt is asserted high. it is cleared by performing a single write to the transmit fifo, or by cl earing the interrupt. uartrtintr: the receive interrupt changes state when one of the fo llowing events occurs: ? if the fifos are enabled and the receive fifo reaches the programmed trigger level. when this happens, the receive interrupt is asserted high. the receive interrupt is cleared by reading data from the receive fifo until it be comes less than the trigger level, or by clearing the interrupt. ? if the fifos are disabled (have a depth of one locati on) and data is received thereby filling the location, the receive interrupt is asserted h igh. the receive interrupt is cleared by performing a single read of the receive fifo, or by cl earing the interrupt. 13.4 register view the pl011 usrt is mapped on base adderss 0x7e20100. it has the fo llowing memory- mapped registers. uart address map address offset register name description size 0x0 dr data register 32 0x4 rsrecr 32 0x18 fr flag register 32
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 178 ? 2012 broadcom corporation. all rights reserved 0x20 ilpr not in use 32 0x24 ibrd integer baud rate divisor 32 0x28 fbrd fractional baud rate divisor 32 0x2c lcrh line control register 32 0x30 cr control register 32 0x34 ifls interupt fifo level select register 32 0x38 imsc interupt mask set clear register 32 0x3c ris raw interupt status register 32 0x40 mis masked interupt status register 32 0x44 icr interupt clear register 32 0x48 dmacr dma control register 32 0x80 itcr test control register 32 0x84 itip integration test input reg 32 0x88 itop integration test output reg 32 0x8c tdr test data reg 32 dr register
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 179 ? 2012 broadcom corporation. all rights reserved synopsis the uart_dr register is the data register. for words t o be transmitted: if the fifos are enabled, data written to this locati on is pushed onto the transmit fifo. if the fifos are not enabled, data is stored in the t ransmitter holding register (the bottom word of the transmit fifo). the write operation initiates transmission from the uar t. the data is prefixed with a start bit, appended with the appropriate pari ty bit (if parity is enabled), and a stop bit. the resultant word is then transmitted . for received words: if the fifos are enabled, the data byte and the 4-bit status (break, frame, parity, and overrun) is pushed onto the 12-bit wide re ceive fifo if the fifos are not enabled, the data byte and status are stored in the receiving holding register (the bottom word of the rece ive fifo). bit(s) field name description type reset 31:12 reserved - write as 0, read as don't care 11 oe overrun error. this bit is set to 1 if data is received and the receive fifo is already full. this is cleared to 0 once there is an empty space in the fifo and a new character can be written to it. rw 0x0 10 be break error. this bit is set to 1 if a break condition was detected, indicating that the received data input was held low for longer than a full-word transmission time (defined as start, data, parity and stop bits). in fifo mode, this error is associated with the character at the top of the fifo. when a break occurs, only one 0 character is loaded into the fifo. the next character is only enabled after the receive data input goes to a 1 (marking state), and the next valid start bit is received. rw 0x0 9 pe parity error. when set to 1, it indicates that the parity of the received data character does not match the parity that the eps and sps bits in the line control register, uart_lcrh select. in fifo mode, this error is associated with the character at the top of the fifo. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 180 ? 2012 broadcom corporation. all rights reserved 8 fe framing error. when set to 1, it indicates that the received character did not have a valid stop bit (a valid stop bit is 1). in fifo mode, this error is associated with the character at the top of the fifo. rw 0x0 7:0 data receive (read) data character. transmit (write) data character. rw 0x0 rsrecr register synopsis the uart_rsrecr register is the receive status register/e rror clear register. if the status is read from this register, then the status information for break, framing and parity corresponds to the data char acter read from the data register, uart_dr. the status information for ov errun is set immediately when an overrun condition occurs. note: the received data character must be read first from the data register, ua rt_dr on before reading the error status associated with that data chara cter from this register. bit(s) field name description type reset 31:4 reserved - write as 0, read as don't care 3 oe overrun error. this bit is set to 1 if data is received and the receive fifo is already full. this is cleared to 0 once there is an empty space in the fifo and a new character can be written to it. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 181 ? 2012 broadcom corporation. all rights reserved 2 be break error. this bit is set to 1 if a break condition was detected, indicating that the received data input was held low for longer than a full-word transmission time (defined as start, data, parity and stop bits). in fifo mode, this error is associated with the character at the top of the fifo. when a break occurs, only one 0 character is loaded into the fifo. the next character is only enabled after the receive data input goes to a 1 (marking state), and the next valid start bit is received. rw 0x0 1 pe parity error. when set to 1, it indicates that the parity of the received data character does not match the parity that the eps and sps bits in the line control register, uart_lcrh select. in fifo mode, this error is associated with the character at the top of the fifo. rw 0x0 0 fe framing error. when set to 1, it indicates that the received character did not have a valid stop bit (a valid stop bit is 1). in fifo mode, this error is associated with the character at the top of the fifo. rw 0x0 fr register synopsis the uart_fr register is the flag register. bit(s) field name description type reset 31:9 reserved - write as 0, read as don't care 8 ri unsupported, write zero, read as don't care rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 182 ? 2012 broadcom corporation. all rights reserved 7 txfe transmit fifo empty. the meaning of this bit depends on the state of the fen bit in the line control register, uartlcr_ lcrh. if the fifo is disabled, this bit is set when the transmit holding register is empty. if the fifo is enabled, the txfe bit is set when the transmit fifo is empty. this bit does not indicate if there is data in the transmit shift register. rw 0x1 6 rxff receive fifo full. the meaning of this bit depends on the state of the fen bit in the uartlcr_ lcrh register. if the fifo is disabled, this bit is set when the receive holding register is full. if the fifo is enabled, the rxff bit is set when the receive fifo is full. rw 0x0 5 txff transmit fifo full. the meaning of this bit depends on the state of the fen bit in the uartlcr_ lcrh register. if the fifo is disabled, this bit is set when the transmit holding register is full. if the fifo is enabled, the txff bit is set when the transmit fifo is full. rw 0x0 4 rxfe receive fifo empty. the meaning of this bit depends on the state of the fen bit in the uartlcr_h register. if the fifo is disabled, this bit is set when the receive holding register is empty. if the fifo is enabled, the rxfe bit is set when the receive fifo is empty. rw 0x0 3 busy uart busy. if this bit is set to 1, the uart is busy transmitting data. this bit remains set until the complete byte, including all the stop bits, has been sent from the shift register. this bit is set as soon as the transmit fifo becomes non-empty, regardless of whether the uart is enabled or not. rw 0x0 2 dcd unsupported, write zero, read as don't care rw 0x0 1 dsr unsupported, write zero, read as don't care rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 183 ? 2012 broadcom corporation. all rights reserved 0 cts clear to send. this bit is the complement of the uart clear to send, nuartcts, modem status input. that is, the bit is 1 when nuartcts is low. rw 0x0 ilpr register synopsis this is the disabled irda register, writing to it has n ot effect and reading returns 0. bit(s) field name description type reset 31:0 ilpr reserved - write zero, read as don't care. rw 0x0 ibrd register synopsis the uart_ibrd register is the integer part of the ba ud rate divisor value. bit(s) field name description type reset 31:16 reserved - write as 0, read as don't care 15:0 ibrd the integer baud rate divisor. rw 0x0 fbrd register synopsis the uart_fbrd register is the fractional part of the b aud rate divisor value. the baud rate divisor is calculated as follows: baud rate divisor bauddiv = (fuartclk/(16 baud rate)) where fuartclk is the uart reference clock frequency. the bauddiv is comprised of the integer value ibrd and the fractional value fbrd. note: the contents of the ibrd and fbrd registers are not up dated until transmission or reception of the current character is compl ete.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 184 ? 2012 broadcom corporation. all rights reserved bit(s) field name description type reset 31:6 reserved - write as 0, read as don't care 5:0 fbrd the fractional baud rate divisor. rw 0x0 lcrh register synopsis the uartlcr_ lcrh register is the line control register . note: the uart_lcrh, uart_ibrd, and uart_fbrd regist ers must not be changed: when the uart is enabled when completing a transmission or a reception when it ha s been programmed to become disabled. bit(s ) field name description type reset 31:8 reserved - write as 0, read as don't care 7 sps stick parity select. 0 = stick parity is disabled 1 = either: if the eps bit is 0 then the parity bit is transmitted and checked as a 1 if the eps bit is 1 then the parity bit is transmitted and checked as a 0. see table 25 9. ro 0x0 6:5 wlen word length. these bits indicate the number of data bits transmitted or received in a frame as follows: b11 = 8 bits b10 = 7 bits b01 = 6 bits b00 = 5 bits. rw 0x0 4 fen enable fifos: 0 = fifos are disabled (character mode) that is, the fifos become 1-byte-deep holding registers 1 = transmit and receive fifo buffers are enabled (fifo mode). rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 185 ? 2012 broadcom corporation. all rights reserved 3 stp2 two stop bits select. if this bit is set to 1, two stop bits are transmitted at the end of the frame. the receive logic does not check for two stop bits being received. rw 0x0 2 eps even parity select. controls the type of parity the uart uses during transmission and reception: 0 = odd parity. the uart generates or checks for an odd number of 1s in the data and parity bits. 1 = even parity. the uart generates or checks for an even number of 1s in the data and parity bits. this bit has no effect when the pen bit disables parity checking and generation. see table 25 9. rw 0x0 1 pen parity enable: 0 = parity is disabled and no parity bit added to the data frame 1 = parity checking and generation is enabled. see table 25 9. rw 0x0 0 brk send break. if this bit is set to 1, a low-level is continually output on the txd output, after completing transmission of the current character. rw 0x0 cr register synopsis the uart_cr register is the control register. note: to enable transmission, the txe bit and uarten bit must be set to 1. similarly, to enable reception, the rxe bit and uart en bit, must be set to 1. note: program the control registers as follows: 1. disable the uart. 2. wait for the end of transmission or reception of the current character. 3. flush the transmit fifo by setting the fen bit to 0 in the line control register, uart_lcrh. 4. reprogram the control register, uart_cr. 5. enable the uart.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 186 ? 2012 broadcom corporation. all rights reserved bit(s) field name description type reset 31:16 reserved - write as 0, read as don't care 15 ctsen cts hardware flow control enable. if this bit is set to 1, cts hardware flow control is enabled. data is only transmitted when the nuartcts signal is asserted. rw 0x0 14 rtsen rts hardware flow control enable. if this bit is set to 1, rts hardware flow control is enabled. data is only requested when there is space in the receive fifo for it to be received. rw 0x0 13 out2 unsupported, write zero, read as don't care ro 0x0 12 out1 unsupported, write zero, read as don't care ro 0x0 11 rts request to send. this bit is the complement of the uart request to send, nuartrts, modem status output. that is, when the bit is programmed to a 1 then nuartrts is low. rw 0x0 10 dtr unsupported, write zero, read as don't care ro 0x0 9 rxe receive enable. if this bit is set to 1, the receive section of the uart is enabled. data reception occurs for uart signals. when the uart is disabled in the middle of reception, it completes the current character before stopping. rw 0x1 8 txe transmit enable. if this bit is set to 1, the transmit section of the uart is enabled. data transmission occurs for uart signals. when the uart is disabled in the middle of transmission, it completes the current character before stopping. rw 0x1 7 lbe loopback enable. if this bit is set to 1, the uarttxd path is fed through to the uartrxd path. in uart mode, when this bit is set, the modem outputs are also fed through to the modem inputs. this bit is cleared to 0 on reset, to disable loopback. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 187 ? 2012 broadcom corporation. all rights reserved 6:3 reserved - write as 0, read as don't care 2 sirlp unsupported, write zero, read as don't care ro 0x0 1 siren unsupported, write zero, read as don't care ro 0x0 0 uarten uart enable: 0 = uart is disabled. if the uart is disabled in the middle of transmission or reception, it completes the current character before stopping. 1 = the uart is enabled. rw 0x0 ifls register synopsis the uart_ifls register is the interrupt fifo level se lect register. you can use this register to define the fifo level that trigge rs the assertion of the combined interrupt signal. the interrupts are generated based on a transition th rough a level rather than being based on the level. that is, the interrupts are generated when the fill level progresses through the trigger level. the bits are reset so that the trigger level is when th e fifos are at the half- way mark. bit(s) field name description type reset 31:12 reserved - write as 0, read as don't care 11:9 rxifpsel unsupported, write zero, read as don't care ro 0x0 8:6 txifpsel unsupported, write zero, read as don't care ro 0x0 5:3 rxiflsel receive interrupt fifo level select. the trigger points for the receive interrupt are as follows: b000 = receive fifo becomes 1/8 full b001 = receive fifo becomes 1/4 full b010 = receive fifo becomes 1/2 full b011 = receive fifo becomes 3/4 full b100 = receive fifo becomes 7/8 full b101-b111 = reserved. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 188 ? 2012 broadcom corporation. all rights reserved 2:0 txiflsel transmit interrupt fifo level select. the trigger points for the transmit interrupt are as follows: b000 = transmit fifo becomes 1/8 full b001 = transmit fifo becomes 1/4 full b010 = transmit fifo becomes 1/2 full b011 = transmit fifo becomes 3/4 full b100 = transmit fifo becomes 7/8 full b101-b111 = reserved. rw 0x0 imsc register synopsis the uart_imsc register is the interrupt mask set/clear register. it is a read/write register. on a read this register returns th e current value of the mask on the relevant interrupt. on a write of 1 to th e particular bit, it sets the corresponding mask of that interrupt. a write of 0 clea rs the corresponding mask. bit(s) field name description type reset 31:11 reserved - write as 0, read as don't care 10 oeim overrun error interrupt mask. a read returns the current mask for the interrupt. on a write of 1, the mask of the uartoeintr interrupt is set. a write of 0 clears the mask. rw 0x0 9 beim break error interrupt mask. a read returns the current mask for the uartbeintr interrupt. on a write of 1, the mask of the interrupt is set. a write of 0 clears the mask. rw 0x0 8 peim parity error interrupt mask. a read returns the current mask for the uartpeintr interrupt. on a write of 1, the mask of the interrupt is set. a write of 0 clears the mask. rw 0x0 7 feim framing error interrupt mask. a read returns the current mask for the uartfeintr interrupt. on a write of 1, the mask of the interrupt is set. a write of 0 clears the mask. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 189 ? 2012 broadcom corporation. all rights reserved 6 rtim receive timeout interrupt mask. a read returns the current mask for the uartrtintr interrupt. on a write of 1, the mask of the interrupt is set. a write of 0 clears the mask. rw 0x0 5 txim transmit interrupt mask. a read returns the current mask for the uarttxintr interrupt. on a write of 1, the mask of the interrupt is set. a write of 0 clears the mask. rw 0x0 4 rxim receive interrupt mask. a read returns the current mask for the uartrxintr interrupt. on a write of 1, the mask of the interrupt is set. a write of 0 clears the mask. rw 0x0 3 dsrmim unsupported, write zero, read as don't care ro 0x0 2 dcdmim unsupported, write zero, read as don't care ro 0x0 1 ctsmim nuartcts modem interrupt mask. a read returns the current mask for the uartctsintr interrupt. on a write of 1, the mask of the interrupt is set. a write of 0 clears the mask. rw 0x0 0 rimim unsupported, write zero, read as don't care ro 0x0 ris register synopsis the uart_ris register is the raw interrupt status regist er. it is a read-only register. this register returns the current raw status value, prior to masking, of the corresponding interrupt. note: all the bits, except for the modem status interru pt bits (bits 3 to 0), are cleared to 0 when reset. the modem status interrupt bit s are undefined after reset. bit(s) field name description type reset 31:11 reserved - write as 0, read as don't care
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 190 ? 2012 broadcom corporation. all rights reserved 10 oeris overrun error interrupt status. returns the raw interrupt state of the uartoeintr interrupt. rw 0x0 9 beris break error interrupt status. returns the raw interrupt state of the uartbeintr interrupt. rw 0x0 8 peris parity error interrupt status. returns the raw interrupt state of the uartpeintr interrupt. rw 0x0 7 feris framing error interrupt status. returns the raw interrupt state of the uartfeintr interrupt. rw 0x0 6 rtris receive timeout interrupt status. returns the raw interrupt state of the uartrtintr interrupt. rw 0x0 5 txris transmit interrupt status. returns the raw interrupt state of the uarttxintr interrupt. rw 0x0 4 rxris receive interrupt status. returns the raw interrupt state of the uartrxintr interrupt. rw 0x0 3 dsrrmis unsupported, write zero, read as don't care rw 0x0 2 dcdrmis unsupported, write zero, read as don't care rw 0x0 1 ctsrmis nuartcts modem interrupt status. returns the raw interrupt state of the uartctsintr interrupt. rw 0x0 0 rirmis unsupported, write zero, read as don't care rw 0x0 mis register
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 191 ? 2012 broadcom corporation. all rights reserved synopsis the uart_mis register is the masked interrupt status re gister. this register returns the current masked status value of the correspo nding interrupt. note: all the bits, except for the modem status interru pt bits (bits 3 to 0), are cleared to 0 when reset. the modem status interrupt bit s are undefined after reset. bit(s) field name description type reset 31:11 reserved - write as 0, read as don't care 10 oemis overrun error masked interrupt status. returns the masked interrupt state of the uartoeintr interrupt. rw 0x0 9 bemis break error masked interrupt status. returns the masked interrupt state of the uartbeintr interrupt. rw 0x0 8 pemis parity error masked interrupt status. returns the masked interrupt state of the uartpeintr interrupt. rw 0x0 7 femis framing error masked interrupt status. returns the masked interrupt state of the uartfeintr interrupt. rw 0x0 6 rtmis receive timeout masked interrupt status. returns the masked interrupt state of the uartrtintr interrupt. rw 0x0 5 txmis transmit masked interrupt status. returns the masked interrupt state of the uarttxintr interrupt. rw 0x0 4 rxmis receive masked interrupt status. returns the masked interrupt state of the uartrxintr interrupt. rw 0x0 3 dsrmmis unsupported, write zero, read as don't care rw 0x0 2 dcdmmis unsupported, write zero, read as don't care rw 0x0 1 ctsmmis nuartcts modem masked interrupt status. returns the masked interrupt state of the uartctsintr interrupt. rw 0x0 0 rimmis unsupported, write zero, read as don't care rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 192 ? 2012 broadcom corporation. all rights reserved icr register synopsis the uart_icr register is the interrupt clear register. bit(s) field name description type reset 31:11 reserved - write as 0, read as don't care 10 oeic overrun error interrupt clear. clears the uartoeintr interrupt. rw 0x0 9 beic break error interrupt clear. clears the uartbeintr interrupt. rw 0x0 8 peic parity error interrupt clear. clears the uartpeintr interrupt. rw 0x0 7 feic framing error interrupt clear. clears the uartfeintr interrupt.. rw 0x0 6 rtic receive timeout interrupt clear. clears the uartrtintr interrupt. rw 0x0 5 txic transmit interrupt clear. clears the uarttxintr interrupt. rw 0x0 4 rxic receive masked interrupt status. returns the masked interrupt state of the uartrxintr interrupt. rw 0x0 3 dsrmic unsupported, write zero, read as don't care rw 0x0 2 dcdmic unsupported, write zero, read as don't care rw 0x0 1 ctsmic nuartcts modem masked interrupt status. returns the masked interrupt state of the uartctsintr interrupt. rw 0x0 0 rimic unsupported, write zero, read as don't care rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 193 ? 2012 broadcom corporation. all rights reserved dmacr register synopsis this is the disabled dma control register, writing to i t has not effect and reading returns 0. bit(s) field name description type reset 31:3 reserved - write as 0, read as don't care 2 dmaonerr unsupported, write zero, read as don't care rw 0x0 1 txdmae unsupported, write zero, read as don't care rw 0x0 0 rxdmae unsupported, write zero, read as don't care rw 0x0 itcr register synopsis this is the test control register uart_itcr. bit(s) field name description type reset 31:2 reserved - write as 0, read as don't care 1 itcr1 test fifo enable. when this bit it 1, a write to the test data register, uart_dr writes data into the receive fifo, and reads from the uart_dr register reads data out of the transmit fifo. when this bit is 0, data cannot be read directly from the transmit fifo or written directly to the receive fifo (normal operation). rw 0x0 0 itcr0 integration test enable. when this bit is 1, the uart is placed in integration test mode, otherwise it is in normal operation. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 194 ? 2012 broadcom corporation. all rights reserved itip register synopsis this is the test control register uart_itip. bit(s) field name description type reset 31:4 reserved - write as 0, read as don't care 3 itip3 reads return the value of the nuartcts primary input. rw 0x0 2:1 reserved - write as 0, read as don't care 0 itip0 reads return the value of the uartrxd primary input. rw 0x0 itop register synopsis this is the test control register uart_itop. bit(s) field name description type reset 31:12 reserved - write as 0, read as don't care 11 itop11 intra-chip output. writes specify the value to be driven on uartmsintr. reads return the value of uartmsintr at the output of the test multiplexor. rw 0x0 10 itop10 intra-chip output. writes specify the value to be driven on uartrxintr. reads return the value of uartrxintr at the output of the test multiplexor. rw 0x0 9 itop9 intra-chip output. writes specify the value to be driven on uarttxintr. reads return the value of uarttxintr at the output of the test multiplexor. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 195 ? 2012 broadcom corporation. all rights reserved 8 itop8 intra-chip output. writes specify the value to be driven on uartrtintr. reads return the value of uartrtintr at the output of the test multiplexor. rw 0x0 7 itop7 intra-chip output. writes specify the value to be driven on uarteintr. reads return the value of uarteintr at the output of the test multiplexor. rw 0x0 6 itip6 intra-chip output. writes specify the value to be driven on uartintr. reads return the value of uartintr at the output of the test multiplexor. rw 0x0 5:4 reserved - write as 0, read as don't care 3 itip3 primary output. writes specify the value to be driven on nuartrts. rw 0x0 2:1 reserved - write as 0, read as don't care 0 itip0 primary output. writes specify the value to be driven on uarttxd. rw 0x0 tdr register synopsis uart_tdr is the test data register. it enables data to be written into the receive fifo and read out from the transmit fifo for t est purposes. this test function is enabled by the itcr1bit in the test contro l register, uart_itcr. bit(s) field name description type reset 31:11 reserved - write as 0, read as don't care 10:0 tdr10_0 when the itcr1 bit is set to 1, data is written into the receive fifo and read out of the transmit fifo. rw 0x0
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 196 ? 2012 broadcom corporation. all rights reserved 14 timer (arm side) 14.1 introduction the arm timer is based on a arm ap804, but it has a number of differences with the standard sp804: ? there is only one timer. ? it only runs in continuous mode. ? it has a extra clock pre-divider register. ? it has a extra stop-in-debug-mode control bit. ? it also has a 32-bit free running counter. the clock from the arm timer is derived from the sy stem clock. this clock can change dynamically e.g. if the system goes into reduced power or in lo w power mode. thus the clock speed adapts to the overal system performance capabilities. for acc urate timing it is recommended to use the system timers. 14.2 timer registers: the base address for the arm timer register is 0x7e 00b000. address offset 8 description 0x400 load 0x404 value (read only) 0x408 control 0x40c irq clear/ack (write only) 0x410 raw irq (read only) 0x414 masked irq (read only) 0x418 reload 0x41c pre - divider (not in real 804!) 0x420 free running counter (not in real 804!) timer load register the timer load register sets the time for the timer to count down. this value is loaded into the timer value register after the load register has been wri tten or if the timer-value register has counted down to 0. 8 this is the offset which needs to be added to the base address to get the full hardware address.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 197 ? 2012 broadcom corporation. all rights reserved timer value register: this register holds the current timer value and is counted down when the counter is running. it is counted down each timer clock until the value 0 is reached. then the value register is re-loaded from the timer load register and the interrupt pending b it is set. the timer count down speed is set by the timer pre-divide register. timer control register: the standard sp804 timer control register consist o f 8 bits but in the bcm implementation there are more control bits for the extra features. control b its 0-7 are identical to the sp804 bits, albeit som e functionality of the sp804 is not implemented. all new control bits start from bit 8 upwards. differences between a real 804 and the bcm implemen tation are shown in italics. name: timer control address: base + 0x40c reset: 0x3e0020 bit(s) r/w function 31:10 - 23:16 r/w free running counter pre - scaler. freq is sys_clk/(prescale+1) these bits do not exists in a standard 804! reset v alue is 0x3e 15:10 - 9 r/w 0 : free running counter disabled 1 : free running counter enabled this bit does not exists in a standard 804 timer! 8 r/w 0 : timers keeps running if arm is in debug halted mode 1 : timers halted if arm is in debug halted mode this bit does not exists in a standard 804 timer! 7 r/w 0 : timer disabled 1 : timer enabled 6 r/w not used , the timer is always in free running mode. if this bit is set it enables periodic mode in a st andard 804. that mode is not supported in the bc2835m. 5 r/w 0 : timer interrupt disabled 1 : timer interrupt enabled 4 r/w 3:2 r/w pre - scale bits: 00 : pre-scale is clock / 1 (no pre-scale) 01 : pre-scale is clock / 16 10 : pre-scale is clock / 256 11 : pre-scale is clock / 1 (undefined in 804) 1 r/w 0 : 16 - bit counters 1 : 23-bit counter 0 r/w not used , the timer is always in wrapping mode. if this bit is set it enables one-shot mode in real 804. that mode is not supported in the BCM2835.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 198 ? 2012 broadcom corporation. all rights reserved timer irq clear register: the timer irq clear register is write only. when wr iting this register the interrupt-pending bit is cleared. when reading this register it returns 0x544d5241 wh ich is the ascii reversed value for "armt". timer raw irq register the raw irq register is a read-only register. it sh ows the status of the interrupt pending bit. name: raw irq address: base + 0x40c reset: 0x3e0020 bit(s) r/w function 31:0 r 0 0 r 0 : the interrupt pending bits is clear 1 : the interrupt pending bit is set. the interrupt pending bits is set each time the val ue register is counted down to zero. the interrupt pending bit can not by itself generates interrupts. interrupts can only be generated if the interrupt enable bit is set. timer masked irq register: the masked irq register is a read-only register. it shows the status of the interrupt signal. it is si mply a logical and of the interrupt pending bit and the interrupt enable bit. name: masked irq address: base + 0x40c reset: 0x3e0020 bit(s) r/w function 31:0 r 0 0 r 0 : interrupt line not asserted. 1 :interrupt line is asserted, (the interrupt pendi ng and the interrupt enable bit are set.) timer reload register: this register is a copy of the timer load register. the difference is that a write to this register do es not trigger an immediate reload of the timer value register. instead the timer load register value is only accessed if the value register has finished co unting down to zero. the timer pre-divider register: name: pre - divide address: base + 0x41c reset: 0x07d bit(s) r/w function 31:10 - 9:0 r/w pre - divider value. the pre-divider register is not present in the sp80 4.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 199 ? 2012 broadcom corporation. all rights reserved the pre-divider register is 10 bits wide and can be written or read from. this register has been added as the sp804 expects a 1mhz clock which we do not h ave. instead the pre-divider takes the apb clock and divides it down according to: timer_clock = apb_clock/(pre_divider+1) the reset value of this register is 0x7d so gives a divide by 126. free running counter name: free running address: base + 0x420 reset: 0x000 bit(s) r/w function 31:0 r counter value the free running counter is not present in the sp80 4. the free running counter is a 32 bits wide read onl y register. the register is enabled by setting bit 9 of the timer control register. the free running cou nter is incremented immediately after it is enabled. the timer can not be reset but when enable d, will always increment and roll-over. the free running counter is also running from the apb clock and has its own clock pre-divider controlled by bits 16-23 of the timer control register. this register will be halted too if bit 8 of the co ntrol register is set and the arm is in debug halt mode.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 200 ? 2012 broadcom corporation. all rights reserved 15 usb the usb core used in the videocore is build from sy nopsys ip. details about the block can be found in dwc_otg_databook.pdf (which can also be downloaded from https://www.synopsys.com/dw/ipdir.php?ds=dwc_usb_2_ 0_hs_otg ) . 15.1 configuration a number of features of the block are specified before the block is build and thus can not be changed using software. the above mentioned document has a list of these under the chapter "configuration parameters". the following table list all configuration parameters mentioned in that chapter and the values which have been chosen. feature/parameter selected value mode of operation 0: hnp - and srp - capable otg (device and host) lpm mode of operation 0: non - lpm - capable core hsic mode of operation 0: non - hsic - capable core architecture 2: internal dma point - to - point application only 0: no high - speed phy interfaces 1: utmi+ usb 1.1 full - speed serial transceiver interface 1: dedicated fs usb ic_usb transceiver interface 0: non - ic_usb - capable default (power on) interface selection: fs_usb/ic_u sb 0 : fs_usb interface data width of the utmi+ interface 0: 8 bits enable i2c interface 0: none enable ulpi carkit 0: no enable phy vendor control interface 0: no
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 201 ? 2012 broadcom corporation. all rights reserved feature/parameter selected value number of device mode endpoints in addition to control endpoint 0 7 enable dedicated transmit fifos for device in endpo ints 1: yes enable descriptor based scatter/gather dma 0: no enable option for endpoint - specific interrupt 0: no number of device mode periodic in endpoints 0 number of device mode in endpoints including control endpo int 0 8 number of device mode control endpoints in addition to endpoint 0 0 number of host mode channels 8 is periodic out channel support needed in host mode 1: yes total data fifo ram depth 4096 enable dynamic fifo sizing 1: yes largest rx data fifo depth 4096 largest non - periodic host tx data fifo depth 1024 largest non - periodic tx data fifo depth 4096 largest host mode tx periodic data fifo dept 4096 non-periodic request queue depth 8 host mode periodic request queue depth 8 device mode in token sequence learning queue depth 8 width of transfer size counters 19
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 202 ? 2012 broadcom corporation. all rights reserved feature/parameter selected value width of packet counters 10 remove optional features 0: no power - on value of user id register 0x2708a000 enable power optimization 0: no is minimum ahb operating frequency less than 60 mhz 1: yes reset style of clocked always blocks in rtl 0: asynchronous instantiate double - synchronization flops 1: yes enable filter on iddig signal from phy 1: yes enable filter on vbus_valid signal from phy 1: yes enable filter on a_valid signal from phy 1: yes enable filter on b_valid signal from phy 1: yes enable filter on session_end signal from phy 1: yes direction of endpoints mode is {in and out} for all endpoin ts largest device mode periodic tx data fifo n depth 768 for all endpoints (except 0) largest device mode in endpoint tx fifon depth (n = 0 to 15) when using dynamic fifo sizing 0=32 1..5=512 6,7=768 15.2 extra / adapted registers. besides the registers as specified in the documentation of synopsys a number of extra registers have been added. these control the analogue usb phy and t he connections of the usb block into the video core bus structure. also the usb_gahbcfg register has an alternative function for the bits [4:1]. base address of the usb block C 0x7e98_0000
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 203 ? 2012 broadcom corporation. all rights reserved offset address description size read/ write 0x080 usb_mdio_cntl mdio interface control r/w 0x084 usb_mdio_gen data for mdio interface 32 r/w 0x088 usb_vbus_drv vbus and other miscellaneous controls r/w usb mdio control (usb_mdio_cntl) address 0x 7e98 0080 bit number field name description read/ write reset 31 mdio_busy 1= mdio read or write in progress 0= mdio idle r 0 30-24 - unused - 0 23 bb_mdo direct write (bitbash) mdo output r/w 0 22 bb_mdc direct write (bitbash) mdc output r/w 0 21 bb_enbl 1= mdio bitbash enable 0= mdio under control of the phy r/w 0 20 freerun 1= mdc is continous active 0 = mdc only active during data transfer r/w 0 19:16 mdc_ratio mdc clock freq is sysclk/mdc_ratio r/w 0 15:0 mdi 16-bit read of mdio input shift register. updates on falling edge of mdc ro 0 table 15-1 mdio control usb mdio data (usb_mdio_data) address 0x 7e98 0084 bit number field name description read/ write reset 31-0 mdio_data 32-bit sequence to send over mdio bu s w 0 31-0 mdio_data 32-bit sequence received from mdio b us r 0 table 15-2 usb mdio data a preamble is not auto-generated so any mdio access mus t be preceded by a write to this register of 0xffffffff. furthermore, a bug in the usb ph y requires an extra clock edge so a write of 0x00000000 must follow the actual access.
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 204 ? 2012 broadcom corporation. all rights reserved usb vbus (usb_vbus) address 0x 7e98 0088 bit number field name description read/ write reset 31-20 - unused - 0 19-16 axi_priority sets the usb axi priority level r/w 0 15:10 - unused - 0 9 vbus_irq 1=one or more bits of [6:4] have changed since last read. this bit is cleared when the register is read. rc 0 8 vbus_irq_en 1=enable irq on vbus status change r/ w 0 7 afe_non_driving 1=usb phy afe pull ups/pull downs are off 0=normal usb afe operation (has no effect if mdio mode is enabled in the phy) r/w 0 6 utmisrp_dischrgv bus drive vbus r 0 5 utmisrp_chrgvbu s charge vbus r 0 4 utmiotg_drvvbus discharge vbus r 0 3 utmiotg_avalid a session valid r/w 0 2 utmiotg_bvalid b session valid r/w 0 1 utmiotg_vbusvali d vbus valid r/w 0 0 utmisrp_sessend session end r/w 0 table 15-3 usb mdio data the rw bits in this register are fed into the usb2.0 cont roller and the ro bits are coming out of it. in the real device, it will be up to the softwa re to communicate this information between the usb2.0 controller and external vbus device (some of these have i2c control, others will have to interface via gpio). usb ahb configuration (usb_gahbcfg) address 0x 7e98 0008 the usb_gahbcfg register has been adapted. bits [4:1] whi ch are marked in the synopsys documentation as "burst length/type (hbstlen)" have been used differently. [4] 1 = wait for all outstanding axi writes to complete before signalling (internally) that dma is done. 0 = don't wait. [3] not used [2:1] sets the maximum axi burst length, but the bits are inverted, 00 = maximum axi burst length of 4, 01 = maximum axi burst length of 3, 10 = maximum axi burst length of 2 11 = maximum axi burst length of 1
06 february 2012 broadcom europe ltd. 406 science park milton road cambridge cb4 0ww page 205 ? 2012 broadcom corporation. all rights reserved personal notes:


▲Up To Search▲   

 
Price & Availability of BCM2835

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X